I am using VB.NET using Visual Stduio 2005. From a Windows application, how to execute another form?

Thanks for your help.

When you say execute, do you mean call a form?

But if you want to load a form you would use something like this:

VB Code.


you need to declare form name as object and use it to call that form.
ex :

dim Dani as new Form2

Thanks a lot.
It resolved my problem.

But if you want to load a form you would use something like this:

VB Code.


it seems you worked on vb6...if in vb.net you must declare object instead a form.
Happy coding friend :)

Here's the code I tried to use, but obviously you can't update two table in one insert statement because my code doesn't work:

Private Sub btnSaveToDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveToDB.Click

        Dim connection As SqlClient.SqlConnection = getConnection()
        Dim insertStatement As String _
            = "INSERT Operations, Operation_Dates" _
            & "(Operation, Date) " _
            & "VALUES (@Operation , @Date )"
        Dim insertCommand As New SqlClient.SqlCommand(insertStatement, connection)
        insertCommand.Parameters.AddWithValue("@Operation", txtOperation.Text.Trim)
        insertCommand.Parameters.AddWithValue("@Date", txtDate.Text.Trim)
            Dim operationCount As Integer = insertCommand.ExecuteNonQuery
        Catch ex As SqlClient.SqlException
        End Try

please ignore my last post, that was supposed to be put int another post.

try to make new thread...don't hijack others thread :)

You can select which form loads first by just changing your project's startup form. Just right click on the Project, click Properties, Application tab, change the "Startup form" setting.

See the concept behind this is that you can do this by first writing form name ,then the control field that you want to use and the action u want to perform...