Oxiegen 88 Basically an Occasional Poster Featured Poster

The form load event.

Private Sub Start_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ' Call the method for a new ID
    txtID.Text = GenerateID()
End Sub

Method for generating an ID.

Private Function GenerateID() As String
    Dim con As New SqlConnection("your connectionstring")
    Dim dr As SqlDataReader = Nothing
    Dim com As SqlCommand = Nothing
    Dim value As String = "0000"
    Dim ID As String
    Try
        ' Fetch the latest ID from the database
        con.Open
        com = New SqlCommand("SELECT TOP 1 <ID> FROM <table> ORDER BY <ID>", con)
        dr = com.ExecuteReader(CommandBehavior.CloseConnection)
        If dr.HasRows
            dr.Read()
            value = dr.Item("<ID>")
        End If
        dr.Close

        ' Increase the ID by 1
        value += 1

        ' Because incrementing a string with an integer removes 0's
        ' we need to replace them. If necessary.
        If value <= 9 Then                'Value is between 0 and 10
            value = "000" & value
        ElseIf value <= 99 Then        'Value is between 9 and 100
            value = "00" & value
        ElseIf value <= 999 Then        'Value is between 999 and 1000
            value = "0" & value
        End If
    Catch ex As Exception
        ' If an error occurs, check the connection state and close it if necessary.
        If con.State = ConnectionState.Open Then
            con.Close()
        End If
        value = "0000"
    End Try

    Return value
End Function
Oxiegen 88 Basically an Occasional Poster Featured Poster

That is true.
However, before you can safely check the value, you need to check if the value exist.
Errors have been known to occur from time to time when storing to a database.
Therefore, first check if value exists. Then check if the value happens to be NULL.
After that, you can do your thing.

This is the part you're asking for.
In order to compare two dates, first make sure they are of the same type. Hence the call to DateTime.TryParse() method.

Dim dateTest As DateTime
        ' Test to see if the value in the database is a date
        If DateTime.TryParse(dataReader("dateColumn"), dateTest) Then
            If dateTest = DateTime.Now Then
                ' Do something
            End If
        End If
Oxiegen 88 Basically an Occasional Poster Featured Poster

Forgive me.
Based on the name of the resource Global.ExampleProject I assumed that it came from a Microsoft example project.

So. Here's another suggestion you can try.
Create a class library project where you store a bunch of resources and compile them into it as bitmaps, in the form of properties.
Then add the library as a reference to your current and future projects.
Voila, instant access to icons, images etc.

ZNERB commented: Helpful Idea +1
Oxiegen 88 Basically an Occasional Poster Featured Poster

That's wierd.
If you debug the For Each..Next code, what does row contain?
And what does row.Cells(0) contain?
Also, is the string variable line being filled?
Have you also perhaps tried to add row.Cells(0).Value.ToString()?

Oxiegen 88 Basically an Occasional Poster Featured Poster
IF dataReader.Read() Then
    If Not IsDBNull(dataReader("dateColumn")) Then
        Dim dateTest As DateTime
        ' Test to see if the value in the database is a date
        If DateTime.TryParse(dataReader("dateColumn"), dateTest) Then
            If dateTest = DateTime.Now Then
                ' Do something
            End If
        End If
    END IF
End If
Oxiegen 88 Basically an Occasional Poster Featured Poster

In the form opening event, call a method that reads the last id from the database into a variable, and increment that value by 1. SELECT TOP 1 <ID> FROM <table> ORDER BY <ID> DESC

Oxiegen 88 Basically an Occasional Poster Featured Poster

Why not locate and remove any reference to Global.ExampleProject.My.Resources.Resources alltogether?
Is it essential for either your projects or the functionality of VS2010 Express in any way?

Oxiegen 88 Basically an Occasional Poster Featured Poster
'Code for retrieving the table from the database.
TextBox1.Text = dataTable1.Columns(0).ColumnName
Oxiegen 88 Basically an Occasional Poster Featured Poster

One step at a time.
Start by grabbing a pen and paper, and design the logic of your project.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Your codesnippets look suspiciously at lot like this project: http://www.codeproject.com/KB/vb/toggleNetworkConn.aspx.

If you read through the authors documentation carefully you will see how to implement what you're looking for.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Do you have any data in the DataGridView?
If it's empty, then the file will be empty.

Oxiegen 88 Basically an Occasional Poster Featured Poster

No, it doesn't.
Try this instead:

If DataGridView1.RowCount > 0 AndAlso DataGridView1.Rows(0).Cells(0) IsNot Nothing Then

Click the link (Toggle Plain Text) above and then copy the line.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Actually. We can remove it and go another way.
I was just being stubborn, thinking I'd make it work.

Private Sub SaveToFile(ByVal fileName As String)
        If DataGridView1.RowCount > 0 AndAlso DataGridView1.Rows(0).Cells(0) IsNot Nothing Then
            Dim stream As New System.IO.FileStream(fileName, IO.FileMode.Append, IO.FileAccess.Write)
            Dim sw As New System.IO.StreamWriter(stream)
            For Each row As DataGridViewRow In DataGridView1.Rows
                Dim line As String
                line = row.Cells(0).ToString()
                line &= ";" & row.Cells(1).ToString()
                line &= ";" & row.Cells(2).ToString()
                line &= ";" & row.Cells(3).ToString()
                line &= ";" & row.Cells(4).ToString()
                line &= ";" & row.Cells(5).ToString()
                line &= ";" & row.Cells(6).ToString()
                line &= ";" & row.Cells(7).ToString()
                line &= ";" & row.Cells(8).ToString()
            Next
Oxiegen 88 Basically an Occasional Poster Featured Poster

Keeping my fingers crossed. :)

Oxiegen 88 Basically an Occasional Poster Featured Poster

Well. Nothing really, except that you would have a data source attached to the DataGrid.
If that is your wish, then you also have to add a bunch of code to deal with updating the datasource with new values.

However, I believe I finally found the solution for the problem at line row.Cells.CopyTo(arrLine, 0) .

They talk about this exact issue in this discussion.
But in your case, if the row currently being read does not contain any information, then the CopyTo method will fail.
Under the line For Each row As DataGridViewRow In DataGridView1.Rows add a line that says If row.Cells(0).Value.Equals("") OrElse row.Cells(0).Value Is Nothing Then Exit For

Oxiegen 88 Basically an Occasional Poster Featured Poster

Aaaargh! Now I see what's wrong. My bad. :)
Change the name of the variable.
Remove the 's' from arrLines in the declaration.

'Change this
Dim arrLine[B]s[/B] .....

' Into this
Dim arrLine .....
Oxiegen 88 Basically an Occasional Poster Featured Poster

Oookay.
The error is because of how the CopyTo method recieves it's arguments, ie the datatypes. The first argument should be an array, but for some reason it won't accept the fact that the variable arrLine is an array.

So let's try this then. See if anyone of these codesnippets works.
Replace the lines in red with the ones in green.

Dim arrLine(9) As String
   Dim arrLines As Array = New String() {}
   Dim line As String
   row.Cells.CopyTo(arrLine, 0)
Dim arrLine(9) As String
   Dim line As String
   row.Cells.CopyTo(arrLine, 0)
   row.Cells.CopyTo(DirectCast(arrLine, Array), 0)
Dim arrLine(9) As String
   Dim arrLines As Array = New String() {}
   Dim line As String
   row.Cells.CopyTo(arrLine, 0)
   row.Cells.CopyTo(DirectCast(arrLine, Array), 0)

There's not just one way to declare and use variables. :)

Oxiegen 88 Basically an Occasional Poster Featured Poster

It is telling me that the line:

row.cells.copyTo(arrLine,0)

it says that the destination array was not long enough. Check DestIndex and length, and the arrays lower bounds.

by the way, dont know if I got the jist of this but the datagridview is 9 columns wide so where you were doing the

line &= ";" & arrLine(1)

I took that for 9 lines.

Actually, it's not 9 lines.
As it states in the uppermost codesnippet, it is the 9 cells (columns) of the current row. The array arrLine is just 1 line (row).

And because you know the number of columns beforehand, we can replace the line Dim arrLine() As String = New String() {} with Dim arrLine(9) As String Also, because both the Cells collection and the array is zero-based, you can remove the line line &= ";" & arrLine(9) .
0 to 8 = 9.

I hope that clear things up a bit.

And, I would like to tell you my real name is Jenn, and Im so glad to have met you :)

My name is Tomas. Very nice to meet you. :)

Oxiegen 88 Basically an Occasional Poster Featured Poster

You need to add some checking here and there.

Try it like this, add and replace the code in red:

Private Sub SaveButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles SaveButton.Click
   Dim fileName As String = ""
   Dim dlgSave As New SaveFileDialog
   dlgSave.Filter = "Text files (*.txt)|*.txt|CSV Files (*.csv)|*.csv"
   dlgSave.AddExtension = True
   dlgSave.DefaultExt = "txt"

   If dlgSave.ShowDialog = Windows.Forms.DialogResult.OK Then
      fileName = dlgSave.FileName
      SaveToFile(fileName)
   End If
End Sub

Private Sub SaveToFile(ByVal fileName As String)
   If DataGridView1.RowCount > 0 AndAlso DataGridView.Rows(0).Cells(0) IsNot Nothing Then
      Dim stream As New System.IO.FileStream(fileName, IO.FileMode.Append, IO.FileAccess.Write)
       Dim sw As New System.IO.StreamWriter(stream)

       'Here we automatically create a CSV formatted text file
       'which in turn can be used to import into Excel. Cool, huh?
       For Each row As DataGridViewRow In DataGridView1.Rows
           Dim arrLine() As String() = New String() {}
           Dim line As String
           row.Cells.CopyTo(arrLine, 0)
           line = arrLine(0)
           line &= ";" & arrLine(1)
           line &= ";" & arrLine(2)
           line &= ";" & arrLine(3)
           ' and so on
           sw.WriteLine(line)
       Next

       sw.Flush()
       sw.Close()
   End If
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

Ok. Nice and simple.
Forget about the database for now. Here's what you do.

Move the save-file code to a separete method.
Then in your SaveButton click event, create a SaveFileDialog and
call the save-file method with the filename from the SaveFileDialog.
Like this:

Private Sub SaveButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles SaveButton.Click
   Dim fileName As String = ""
   Dim dlgSave As New SaveFileDialog

   If dlgSave.ShowDialog = Windows.Forms.DialogResult.OK Then
      fileName = dlgSave.FileName
      SaveToFile(fileName)
   End If
End Sub

Private Sub SaveToFile(ByVal fileName As String)
   Dim stream As New System.IO.FileStream(fileName, IO.FileMode.Append, IO.FileAccess.Write)
    Dim sw As New System.IO.StreamWriter(stream)

    'Here we automatically create a CSV formatted text file
    'which in turn can be used to import into Excel. Cool, huh?
    For Each row As DataGridViewRow In DataGridView1.Rows
        Dim line As String = ""
        line = row.Cells(0).Value.ToString()
        line &= ";" & row.Cells(1).Value.ToString()
        line &= ";" & row.Cells(2).Value.ToString()
        line &= ";" & row.Cells(3).Value.ToString()
        sw.WriteLine(line)
    Next

    sw.Flush()
    sw.Close()
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

Ah. Of cource. I'm sorry.
Instead of fileName you can enter either a string containing a full path and/or filename or add a SaveFile dialog to your form for selecting a path and filename.
And this part of the code should read:

For Each row As DataGridViewRow In DataGridView1.Rows
        Dim line As String = ""
        line = row.Cells(0).Value.ToString()
        line &= ";" & row.Cells(1).Value.ToString()
        line &= ";" & row.Cells(2).Value.ToString()
        line &= ";" & row.Cells(3).Value.ToString()
        sw.WriteLine(line)
    Next
Oxiegen 88 Basically an Occasional Poster Featured Poster
Public Position As Integer
Public Function Fibonacci() As Double
   If Position > -1 Then
      'A for loop
   End If
End Function
Public Function Fibonacci(ByVal position As Integer) As Double
   ' A Do Until loop
End Function
Oxiegen 88 Basically an Occasional Poster Featured Poster

Here's what I usually do, following Luc001's example.
Add a handler for the FormClosed event.
When you close the newly opened form, the event will be triggered and dispose of the object.
And any future openings of the form will be with a fresh copy.

Public Class Form1
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
                Dim frm2 As New Form2
                frm2.MdiParent = Me
                frm2.Show()
                AddHandler frm.FormClosed, AddressOf frm_Closed
    End Sub

        Private Sub frm_Closed(ByVal sender As Object, ByVal e As EventArgs)
                DirectCast(sender, Form2).Dispose()
        End Sub
End Class
Oxiegen 88 Basically an Occasional Poster Featured Poster

TryParse takes two arguments.
The first argument is the date to parse.
The second argument is a referenced variable that will contain the parsed date.
TryParse returns a boolean value indicating if the parsing was successful. And if True, the second argument will contain the parsed date.

Try this:

Private Sub CompareMonths()
   Dim labourhours As Integer
   Dim overheads As Integer = 12.5
   Dim labourprofit As Integer

   Dim currentMonth As Integer = DateTime.Now.Month
   Dim parseMonth As Integer = 0
   Dim DateDue As DateTime = Nothing

   ' Iterate all rows in table
   For Each row As DataRow In KiwicyclesDataSet.Repair.Rows
      ' Check if field is NULL
      ' Must use brackets if the field contains spaces
      If Not IsDBNull(row("[Date Due]")) Then 
         ' Try to parse the date from the current row
         If DateTime.TryParse(row("[Date Due]"), DateDue) Then
            ' Retrieve the month part of the date
            parseMonth = DateDue.Month
            labourhours = row.Item("NoOfLabourHours") * (30)
            ' Compare the two months
            If currentMonth.Equals(parseMonth) Then
               labourprofit = labourprofit + ((overheads) / (labourhours) * 100)
            End If
         End If
      End If
   Next
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

Yes. The principle is the same for both ListView and DataGridView.
Note that DataGridViewCell doesn't have a constructor.

Populate gridview:

Private Sub TheLastComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles TheLastComboBox.SelectedIndexChanged
    Dim row As New DataGridViewRow 'The row object
    Dim cell As DataGridViewCell 'The columns

    cell.Value = TheFirstComboBox.GetItemText(TheFirstComboBox.SelectedItem)
    row.Cells.Add(cell)

    cell.Value = TheSecondComboBox.GetItemText(TheSecondComboBox.SelectedItem)
    row.Cells.Add(cell)

    cell.Value = TheThirdComboBox.GetItemText(TheThirdComboBox.SelectedItem)
    row.Cells.Add(subItem)

    ' And so on, and so on

    DataGridView.Rows.Add(row)
End Sub

And to store to file:

Private Sub SaveButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles SaveButton.Click
   Dim stream As New System.IO.FileStream(fileName, IO.FileMode.Append, IO.FileAccess.Write)
    Dim sw As New System.IO.StreamWriter(stream)

    'Here we automatically create a CSV formatted text file
    'which in turn can be used to import into Excel. Cool, huh?
    For Each row As DataGridViewRow In DataGridView1.Rows
        Dim line As String = ""
        line = item.Text
        line &= ";" & row.Cells(0).Value.ToString()
        line &= ";" & row.Cells(1).Value.ToString()
        line &= ";" & row.Cells(2).Value.ToString()
        sw.WriteLine(line)
    Next

    sw.Flush()
    sw.Close()
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

For ListView you should not use SelectedItems in this manner.
SelectedItems is a collection of selected items (rows) in the ListView.
So, if there's only 1 row selected then SelectedItems only contain 1 item. Therefore LVW.SelectedItems(1) will result in error.

If you wish to retrieve values from the subsequent columns of the row that is selected you can use the SubItems property.

Private Sub txtFill_Click()
txtTAID.Text = LVW.SelectedItems(0).Text
txtVNO.Text = LVW.SelectedItems(0).SubItems(0).Text
txtVNM.Text = LVW.SelectedItems(0).SubItems(1).Text
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

Well. Unless you use a database of some sort as a backend, you don't have any real need for binding.

Here's what you can do.
Use the ListView control. It can be configured in a detail mode. Like the Windows Explorer.
Then, if you know beforehand what different information the list will contain, you can manually add columns in design mode.
Once that is done, it's a fairly simple matter to add items (rows) to the list. Like this:

Private Sub TheLastComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles TheLastComboBox.SelectedIndexChanged
    Dim item As New ListViewItem 'The very first column in the list
    Dim subItem As New ListViewItem.ListViewSubItem 'Subsequent columns in the list

    item.Text = TheFirstComboBox.GetItemText(TheFirstComboBox.SelectedItem)
    subItem.Text = TheSecondComboBox.GetItemText(TheSecondComboBox.SelectedItem)
    item.SubItems.Add(subItem)

    subItem = New ListViewItem.ListViewSubItem
    subItem.Text = TheThirdComboBox.GetItemText(TheThirdComboBox.SelectedItem)
    item.SubItems.Add(subItem)

    ' And so on, and so on

    ListView1.Items.Add(item)
End Sub

At the end of the day you will have a ListView with a whole bunch of items (rows).
So, then add a button to store all that into a file by iterating (loop) through all the rows.

Private Sub SaveButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles SaveButton.Click
   Dim stream As New System.IO.FileStream(fileName, IO.FileMode.Append, IO.FileAccess.Write)
    Dim sw As New System.IO.StreamWriter(stream)

    'Here we automatically create a CSV formatted text file
    'which in turn can be used to import into Excel. Cool, huh?
    For Each item As ListViewItem In ListView1.Items
        Dim line As String = ""
        line = item.Text
        line &= ";" & item.SubItems(0).Text
        line &= …
Oxiegen 88 Basically an Occasional Poster Featured Poster

I'm not entirely sure why you get the error.
But I'm thinking you had the thought of using the index in Public Sub RedrawMap(ByVal index As Integer) for something.
Perhaps a layer or object index?

Oxiegen 88 Basically an Occasional Poster Featured Poster

If you Google with the keywords "vb.net gdi+ animation" you will find that there is a lot of guides and tutorials out there for how to accomplish this.
Here's one, for example: http://www.freevbcode.com/ShowCode.asp?ID=5601

Oxiegen 88 Basically an Occasional Poster Featured Poster

How about creating a class instead.
That way you will be able to gather all calculations in one place.

Here's a simple example.

'In your form
Private clsAddItem As AddItemClass
Private Sub button_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button.Click
   clsAddItem = New AddItemClass("book title")
   TaxLabel.Text = clsAddItem.Tax
   ShippingLabel.Text = clsAddItem.Shipping
   ' and so on
End Sub

'A class file
Public Class AddItemClass
#Region " Member Variables "
    Private decSubTotal As Decimal

    Private strSelectedBook As String
    Private strSubTotal As String

    Private intPrice As Integer

    Const decSALESTAXPERCENT As Decimal = CDec(0.06) 'current sales tax
    Const intPERITEMSHIPPING As Integer = 2 'item shipping charge
#End Region

#Region " Constructors "
    Public Sub New()

    End Sub

    Public Sub New(ByVal BookTitle As String)
        strSelectedBook = BookTitle
    End Sub
#End Region

#Region " Private Methods "
    Private Function GetPrice() As String
        ' Check if strSelectedBook = ""
        Return "some price"
    End Function

    Private Function CalculateTax() As String
        ' Check if strSelectedBook = ""
        Return "some tax"
    End Function

    Private Function CalculateShipping() As String
        ' Check if strSelectedBook = ""
        Return "some shipping"
    End Function

    Private Function CalculateTotal() As Decimal
        ' Check if strSelectedBook = ""
        Return 0.0
    End Function
#End Region

#Region " Properties "
    Public ReadOnly Property Price() As String
        Get
            Return GetPrice()
        End Get
    End Property

    Public ReadOnly Property Tax() As String
        Get
            Return CalculateTax()
        End Get
    End Property

    Public ReadOnly Property Shipping() As String
        Get
            Return CalculateShipping()
        End Get
    End Property

    Public ReadOnly Property Total() As Decimal …
Oxiegen 88 Basically an Occasional Poster Featured Poster

combobox1.GetItemText(combobox1.SelectedItem) returns the text for the currently selected item.

This writes a line of string into a file.

Private Sub SaveToFile(fileName As String, data As String)
   Dim stream As New System.IO.FileStream(fileName, FileMode.Create)
   Dim sw As New System.IO.StreamWriter(stream)
   sw.WriteLine(data)
   sw.Flush()
   sw.Close()
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

You have two options.
1) Create an object with the scores and use serialization for storing into a file.
http://www.switchonthecode.com/tutorials/csharp-tutorial-serialize-objects-to-a-file
2) Store the scores in the Registry. http://www.codeproject.com/KB/vb/registry_with_vb.aspx

Oxiegen 88 Basically an Occasional Poster Featured Poster

Close, but no cigar.
Try it like this instead.
Notice that I removed some single-quotes and changed the plus-sign (+) into an ampersand (&).

ODBC_COM = New OdbcCommand("UPDATE President SET " & President_UPDATE_field.Text & " = '" & President_UPDATE_text.Text & "'", ODBC_CON)
ODBC_COM.ExecuteNonQuery()

Also. If you put it all inside a Try...Catch statement, you can put a MessageBox.Show(ex.ToString) inside the Catch to see what's going on if an error occurs.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Something like this.

Private Sub CompareMonths()
   'I don't know what DataSet.Repair is or does.

   Dim currentMonth As Integer = DateTime.Now.Month
   Dim parseMonth As Integer = 0
   Dim parseDate As DateTime = Nothing

   ' Iterate all rows in table
   For Each row As DataRow In DataSet.Tables(0).Rows
      ' Check if field is NULL
      If Not IsDBNull(row("DateCollected")) Then
         ' Try to parse the date from the current row
         If DateTime.TryParse(row("DateCollected"), parseDate) Then
            ' Retrieve the month part of the date
            parseMonth = parseDate.Month
            ' Compare the two months
            If currentMonth.Equals(parseMonth) Then
               'Do something
            End If
         End If
      End If
   Next
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

Well. Then I'm fresh out of ideas.
See if this will be of any help: http://stackoverflow.com/questions/210342/vb-net-click-submit-button-on-webbrowser-page

Oxiegen 88 Basically an Occasional Poster Featured Poster

If you attempt a login but it failes, the source will be different.
This is what you need to check for.

<td width="100%" class="maincontentcell"><div class="page_title">Login</div>
 
		<br><br>
		<hr>
		<b>Warning</b> - Your login attempt failed. The username and/or password you entered are not valid.
		<br>
		<br>
		Please make sure that you are using the correct email address as your user name.<br>
		<br>
		You can try to login again by entering your username and password in the login box below.
		<br><br>
		If you forgot your password you can recover it here <a href="http://www.articlecat.com/recover.php">recover password</a>
		<hr>
		<br><br>
		<br><br>
		<br><br>
		
<p>To login please enter your email and password in the form below.</p>
<br><br><br>
<center>
<form name="clearform" action="https://www.articlecat.com/secure/login.php" method="post">
Oxiegen 88 Basically an Occasional Poster Featured Poster

I tried the page and whipped up a sample code to test this.

The login page uses itself as a postback form, so the page will reload every time you perform a submit from your code.
Unless you check the document source for any warning text that the login failed, the page will continue to reload.
I don't know what happens on a successful login, so I have no reference to that end, whether or not you will be redirected to a new page.

In conclusion.
You have to add code before you set the values and submit, to check the document source for any text or information so that you can decide whether or not to submit the form.

Oxiegen 88 Basically an Occasional Poster Featured Poster

There are many methods to do this.
But here's how I do things.

' First add this in a new class file
Imports System.Threading

Public Class DoSomeThreading
   Private m_clsThread As Thread
   Private m_clsNotifyDelegate As NotifyProgress
   Private m_clsSynchronizationObject As System.ComponentModel.ISynchronizeInvoke

   Public Delegate Sub NotifyProgress(ByVal Message As String)

   Public Sub New(ByVal SynchronizationObject As System.ComponentModel.ISynchronizeInvoke, ByVal NotifyDelegate As NotifyProgress)
      m_clsSynchronizationObject = SynchronizationObject
      m_clsNotifyDelegate = NotifyDelegate
   End Sub

   Public Sub Start()
      m_clsThread = New Thread(AddressOf DoWork)
      m_clsThread.IsBackground = True 'Not sure if necessary
      m_clsThread.Start()
   End Sub

   Private Sub DoWork()
      Do While m_clsThread.IsAlive
         'Here you put the code for port scanning
         NotifyUI("status text")
         Thread.Sleep(5000) 'Pause the thread for 5 seconds
      Loop
   End Sub

   Private Sub NotifyUI(ByVal Message As String)
      If m_clsNotifyDelegate IsNot Nothing Then
         Dim args(0) As Object
         args(0) = Message
         m_clsSynchronizationObject.Invoke(m_clsNotifyDelegate, args)
      End If
   End Sub

   'Add some methods or properties to kill the thread.
End Class

' Then in your form
Public Class Form1
   Private Sub someButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles someButton.Click
      Dim threadClass As New DoSomeThreading(Me, New DoSomeThreading.NotifyProgress(AddressOf StatusReport))
      threadClass.Start()
   End Sub

   Private Sub StatusReport(ByVal Message As String)
      lblStatus.Text = Message
   End Sub
End Class
Oxiegen 88 Basically an Occasional Poster Featured Poster

If the actual checking works.
Then perhaps you should look into Threading instead of a Timer.

Oxiegen 88 Basically an Occasional Poster Featured Poster

A suggestion:
Add a class variable of type List(Of Object).
For each time you press the btnCalculate button you add totals(,) to that variable.
Then iterate through the list and add it's content to a string variable that you display in a MessageBox.

Example:

Private Sub example()
            Dim values As New List(Of Object)
            Dim text As String = ""

            For Each item As Decimal In values
                text &= item.ToString & vbCrLf
            Next
            MessageBox.Show(text)
        End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

Have you also tried Invalidate() and Update()?

Oxiegen 88 Basically an Occasional Poster Featured Poster

Yes, it is.
You should look into using WMI.
An example: http://www.freevbcode.com/ShowCode.asp?ID=4571

Oxiegen 88 Basically an Occasional Poster Featured Poster

In your code for btnRemoveLine, do this:

If lstMenuItem.SelectedIndex <> -1 AndAlso lstPrice.SelectedIndex <> -1 AndAlso lstQuantity.SelectedIndex <> -1 Then
       Dim index As Integer = lstPrice.SelectedIndex
       lstPrice.Items.RemoveAt(index)
       lstMenuItem.Items.RemoveAt(index)
       lstQuantity.Items.RemoveAt(index)
End If
Oxiegen 88 Basically an Occasional Poster Featured Poster

How about this.
Use the picturebox's Tag property and set it's values to a value that should go into these lines filled(0, 0) .

Then you can do this:

Private Sub Change_Image(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles PictureBox1.Click, PictureBox2.Click, PictureBox3.Click, _
            PictureBox4.Click, PictureBox5.Click, PictureBox6.Click, _
            PictureBox7.Click, PictureBox8.Click, PictureBox9.Click

        Dim intValue As Integer = CInt(DirectCast(sender, PictureBox).Tag)

        If filled(0, intValue) = 0 Then
            filled(0, intValue) = 1
            If player = 1 Then
                DirectCast(sender, PictureBox).Image = My.Resources.x
                player = player + 1
            Else
                DirectCast(sender, PictureBox).Image = My.Resources.o
                player = player - 1
            End If
        End If
    End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

There was another user that had a similar problem as you.
Although he was using databinding, I think the concept is the same.
Download this Zip file from my webserver and examine what I've done.
http://zoloft.shacknet.nu:8080/~oxiegen/DaniWeb/trythis.zip

Oxiegen 88 Basically an Occasional Poster Featured Poster

You are very welcome. :)

Oxiegen 88 Basically an Occasional Poster Featured Poster

Here's a nice tutorial on coding with databases.
http://www.homeandlearn.co.uk/NET/nets12p4.html

Oxiegen 88 Basically an Occasional Poster Featured Poster

Weird. Let's try this.

Dim SQL As String = "UPDATE Customers SET [First Name] = '" & txtEditFirstName.Text & "'," _
& "[Last Name] = '" & txtEditLastName.Text & "'," _
& "[Address 1] = '" & txtEditAddress1.Text & "'," _
& "[Address 2] = '" & txtEditAddress2.Text & "'," _
& "Postcode = '" & txtEditPostcode.Text & "'," _
& "[Phone Number] = '" & txtEditPhoneNumber.Text & "' " _
& "WHERE ID = '" & txtCustomerID.Text & "'"

EditCustomerAdapter = New OleDb.OleDbDataAdapter(SQL, EditCustomerConnection)
Oxiegen 88 Basically an Occasional Poster Featured Poster

Try again. Make sure that the commas are within the quotes, except the last one in front of EditCustomerConnection.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Note the blank space at the end of line 6.

EditCustomerAdapter = New OleDb.OleDbDataAdapter("UPDATE Customers SET [First Name] = '" & txtEditFirstName.Text & "'," _
            "[Last Name] = '" & txtEditLastName.Text & "'," _
            "[Address 1] = '" & txtEditAddress1.Text & "'," _
            "[Address 2] = '" & txtEditAddress2.Text & "'," _
            "Postcode = '" & txtEditPostcode.Text & "'," _
            "[Phone Number] = '" & txtEditPhoneNumber.Text & "' " _
"WHERE ID = '" & txtCustomerID.Text & "'", EditCustomerConnection)