samir_ibrahim 58 Junior Poster

You can embed Excel and Word inside vb/c# form. I also suffered alot to get a working a code where I found alot of posts says that web browser can embed excel but that did not work with me

Here is my way

Add a Form, Button, Panel
This will display Excel inside the panel

Add Refrence to : Microsoft Office ?? Object Library

Imports Microsoft.Office.Interop

Public Class Form1
    Declare Auto Function SetParent Lib "user32.dll" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
    Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
    Private Const WM_SYSCOMMAND As Integer = 274
    Private Const SC_MAXIMIZE As Integer = 61488
    Private Sub btnShowExcel_Click(sender As Object, e As EventArgs) Handles btnShowExcel.Click
        Dim sExcelFileName = "C:\myfolder\myexcel.xlsx"
        Dim oExcel As New Excel.Application
        oExcel.DisplayAlerts = False
        oExcel.Workbooks.Open(sExcelFileName)
        oExcel.Application.WindowState = Excel.XlWindowState.xlMaximized
        oExcel.Visible = True

        SetParent(oExcel.Hwnd, pnlExcel.Handle)
        SendMessage(oExcel.Hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0)
    End Sub
End Class
samir_ibrahim 58 Junior Poster

There could be some security restriction if you install the access database in c:\program file\your_folder or c:\program file (x86)\your_folder . If you do, try to to give full access to the folder where your data reside by right click on the folder and press properties >> security tab.

samir_ibrahim 58 Junior Poster

your query will not return the columns name "locid,locname,locadd", it will return 1 column as you put in the query

your only column is MAX(locid), and since you didnot specify the a name by using MAX(locid) as FieldName, its hard to tell what will be the column name.

You are getting 1 column contains Max(locid), so to get it correctly

dtr.Read()
xt_locid.Text = dtr(0).ToString

and remove the other two since they don't exist.

samir_ibrahim 58 Junior Poster

Thank you cscgal for getting back my request.

Keep the nice improvement for this site.

samir_ibrahim 58 Junior Poster

I can tell that you are answering questions and you are very active in many forums, I cannot see Serkan activity in vb I guess he is C# Guy.

Keep going.

samir_ibrahim 58 Junior Poster

What do you mean by "its worked for local machine."?
You installed Sql server locally on a macine and your code works? how the client suppose to connect (also locally or remotely)?

Check if you change the password for the administrator.

kvprajapati commented: Good point. +11
samir_ibrahim 58 Junior Poster

Pls see my code.Nothing is displaying in the grid

Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
          Dim connString As String = "Provider=SQLOLEDB;Data Source=MSALAMEEN;uid=sa;pwd=Sa1;Initial Catalog=Biometric"
        Dim myConnection As OleDbConnection = New OleDbConnection
        myConnection.ConnectionString = connString
        Dim da As OleDbDataAdapter = New OleDbDataAdapter("Select ID from bdata", myConnection)
        Dim ds As DataSet = New DataSet
        Dim dc1 As DataColumn = New DataColumn
        'da.Fill(ds)
        da.Fill(ds, "bdata")
        dc1 = ds.Tables("bdata").Columns("id")
        DataGridView1.DataSource = ds.DefaultViewManager

Try this,
After the last line add DataGridView1.DataMember = "bdata"

kvprajapati commented: Yes, it is. +11
samir_ibrahim 58 Junior Poster

For your first question, and it is my own opinion, I prefer that you create a view on the SQL Server side, and call this view whenever you need it. (at least less coding)

For your second question regarding filter. That is a big question and cannot be answered directly unless you shrink it :)

It depend on how you connect to the SQL Server using (Dataset (design or coding), SQLClient.Command Object, or LINQ)

So what do use?

about your question if the query can be combined with the form control as you type it, AFAIK the answer is no, but you could combine the form control + query in the query string, for ex:

_sql = "Select * from mytable where field1 = " + text1.text

hth

samir_ibrahim 58 Junior Poster

As fast response, you have 2 things missing
Inet <-- is not declared
DivideText <-- which i guess it is a function is not there is your code.

You can stick with your code, and you can use my code if you find it better

Dim xmlHTTP
Dim URL As String
Set xmlHTTP = CreateObject("MSXML2.XMLHTTP")
URL = "http://www.perceler.com/getipadr1.php"
xmlHTTP.Open "GET", URL, False
xmlHTTP.Send
Debug.Print xmlHTTP.responseText
BillWebber commented: Nice of him to offer me some help. Thank you. +3
samir_ibrahim 58 Junior Poster

I did some research and here is my result
#1 subitem image is no longer supported in listview for vb.net
http://social.msdn.microsoft.com/forums/en-US/winforms/thread/355566d9-5b17-4654-ab78-61394713c05c/
#2 you can use the vb6 listview and use the reporticon
http://www.vbforums.com/showthread.php?t=25032
#3 search google for "vb.net OAKListView"
http://www.codeproject.com/KB/list/OAKListView.aspx?display=PrintAll

hth

Ramy Mahrous commented: Great links +6
samir_ibrahim 58 Junior Poster

Hi Comatose

When dealing with servers (which are usually important to the company) the safest way to move the database, is to duplicate it first....

That is not necessary.
De-Attach and Attach are safe method and you can do it with no fear of data lost unless the database you want to move has a replication.

then later remove it from the source. So while you are right, moving and duplicating are different.... would you think it is wise from an administration point of view to move the data? No. You duplicate the data... then if everything goes well, you delete the old data.

I agree, always take a backup before doing such thing

There is three kind of copying/duplicating the DB from one server to another. Backup/Restore,De-attach/Attach, Copy Directly from source to destination.
Each one has it is own characteristics and depends on the situation(error in replication, server hardware failure, etc..) he should choose which one he should use.

So, assuming we are people who have server administration experience (could be a big assumption), I'd say it's a safe bet to not even talk about the act of "moving" data directly.........

I have Microsoft certificate in MSSQL Server Admin in 2003 ad I have 8 years of experience in SQL Server Administrator :)

Comatose commented: Nice Response +10
samir_ibrahim 58 Junior Poster

Hi,
If I understand, you want to create a restaurant application and you don't have a base knowledge.

I guess you have 2 solution

#1 Go to a restaurant holding a paper and pen, and start asking question about how the operation flows and then create your app
#2 Download many demo restaurant software, and take an idea of how they work.

My advice? is #1 First then #2 then #3 which is start creating your application

Comatose commented: Great Response +9
samir_ibrahim 58 Junior Poster

Thank you all for your response.

I had found t hi s code which is very short 3 lines if you remove the first 3 lines which are for explanatory purpose

Dim SearchFor, SearchIn As String
SearchIn = "She sells sea shells on the sea shore"
SearchFor = "sea"
Dim rex As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex(SearchFor)
Dim count As Integer = rex.Matches(SearchIn).Count
MessageBox.Show(SearchFor & " occurs " & count & " times")
Comatose commented: Great Find +8