Friday, July 30, 2010

Friday, July 30th

Looking at retrieving data from a database using a Windows form.

So far, I am amazed with how much can be done by defining properties in vb.net, such as the DataBindings property


Dim variableName As Data.DataView = New Data.DataView(DatabaseDataSet.xyz)


I think that's the correct syntax, anyway.

In the background to all this learning about relational databases, SQL server and ADO.NET

There is a problem with the where clause I a supposed to add when building a search criteria, i have follow the directions of the tutorial to a T (or so I think) and yet it still isn't working. I am going to switch to doing another tutorial series for a while.

Thursday, July 29, 2010

Thursday, July 29th 2010

VB.Net

Working with the old North Wind db.

Learned about formatting for elements on forms, or at least started using that feature. Very cool!

The tutorial I am working on will be the first to feature multiple forms, which is interesting.

First time for me add a menu to a form.

Learned how to link one form to another


frmName.Show()


Learned about adding Tabs and creating a TabControl

Will be hooking the database to the form tomorrow.

Wednesday, July 28, 2010

Wednesday, July 28 2010

Visual Basic 6

- Looking at the Form_Load event: writing code to display the date on a label

Label1.Caption = "Today is " & Date


It's strange for me to think that it is so simple as to just write "Date" and the computer knows to display the date.

Caption is of course archaic, now with VB.net you write "Text" which is much snazzier. The Command button has also changed to just regular button

- Subprocedures

A subprocedure is the name Visual Basic gives to a block of a code

I am inferring here that subprocedures can be stored in separate modules - modules being pure code (just subprocedures) without any forms.

MsgBox "Put Message Here", vbExclamation


The constant vbExclamation defines the kind of message box that we want to appear - in this case one with a yellow triangle and an exclamation point in the middle


- If / Then statements - seem to be handled differently in VB6 than VB.net

I customized my own program to imitate a password entry registration form - you know the one where you have to enter the password twice and if you get it wrong you have to redo the entire form again (well, usually now they just make you reenter the password, but in the old days...)

The first program I wrote went like this:


Private Sub cmdEnter_Click()

Dim Password As String
Dim Confirm As String

Password = txtPassword.Text
Confirm = txtConfirm.Text

If Password = Confirm Then
MsgBox "Great - password accepted!"
Unload Form1
End
Else
MsgBox "Sorry, passwords do not match."
txtPassword.Text = ""
txtConfirm.Text = ""
txtPassword.SetFocus
End If

End Sub



This worked pretty well, but what if someone didn't enter any password at all?

Just messing around, I changed the code above into a subroutine, enterClick then rewrote the cmdEnter_Click() as



If txtPassword.Text = "" And txtConfirm.Text = "" Then
MsgBox "Sorry, no password entered!"
txtPassword.SetFocus
Else
Call enterClick
End If



- Misc

Apparently there is a password property, the one that masks your password when you type it in with **** (actually you can define the character that you want to have replace the letters / numbers )

VisualBasic.Net

(Note to self - I have a 64 bit operating system)

One of the books that I am using is supposed to use the Northwind Database that goes with SqlServer and SqlExpress, but I think that database is no longer supported.

Installing SQL Server Expres onto my computer