Microsoft Visual Basic 2005 Express Edition Guide!

Soldato
Joined
8 Oct 2003
Posts
2,897
Location
Glasgow
Hi

Ive been using VB6 for 3/4 yrs now on placements and a full yr at work, and after moaning we are upgrading to Studio2005 however i have dl'd the express edition to try pic it up and im beyond lost :)

Can someone point me at some decent guides ? the one that came with it is a bit weak.

Im basicly looking for anything thats doing basic qrys from a SQL dbase ie check user name and password and asign it to a string value

Also how do you define a variable as Global in 2005 ?

Thx Kevin

PS i dont have the internet at work so i havent really checked the msforums going to have a look later on but i am going out with my missus today :)
 
kkelly said:
Hi

Ive been using VB6 for 3/4 yrs now on placements and a full yr at work, and after moaning we are upgrading to Studio2005 however i have dl'd the express edition to try pic it up and im beyond lost :)

Can someone point me at some decent guides ? the one that came with it is a bit weak.

Im basicly looking for anything thats doing basic qrys from a SQL dbase ie check user name and password and asign it to a string value

Also how do you define a variable as Global in 2005 ?

Thx Kevin

PS i dont have the internet at work so i havent really checked the msforums going to have a look later on but i am going out with my missus today :)

There are some free videos available that would be get started on the MS site.

"Global" variable is a "Public" variable in vb.net
 
Try not to use Global Variables. If you do need something that is accessable throught the project create a setting that can be accessed by My.Setting.SettingName

To connect to a database I usually do something like this:
Code:
            Try
                Using sqlCnn As New SqlConnection(My.Settings.sqlString)
                    sqlCnn.Open()

                    Dim sqlQry As String = "INSERT INTO ... WHERE ID = @ID"

                    Using sqlCmd As New SqlCommand(sqlQry, sqlCnn)
                        sqlCmd.CommandType = CommandType.Text
                        sqlCmd.Parameters.Clear()
                        sqlCmd.Parameters.Add("@parm7", SqlDbType.Int).Value = 1
                        sqlCmd.Prepare()
                        sqlCmd.ExecuteNonQuery()
                        sqlCmd.Dispose()
                    End Using

                    sqlCnn.Close()
                    sqlCnn.Dispose()
                End Using
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
TrUz
 
You shouldn't need to use Global variables appart from something like a connection string etc... Using My.Settings for this is perfect. Also it makes a program harder to maintain with loads of global variables about. If you need to pass data between forms, create properties. If you need to pass lots of data then Class + ArrayList will do the trick. :)

TrUz
 
Back
Top Bottom