Oxiegen 88 Basically an Occasional Poster Featured Poster

I've been looking through the code and have found a bunch of coding errors. My bad!

First, for this to work properly the DataGrid needs to have columns. Which you've added already.

Next, we need to revise the code for the last combobox.

Dim row As New DataGridViewRow 'The row object
        Dim cell As DataGridViewCell = New DataGridViewTextBoxCell 'The columns

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

        cell = New DataGridViewTextBoxCell
        cell.Value = ComboBox2.GetItemText(ComboBox2.SelectedItem)
        row.Cells.Add(cell)

        cell = New DataGridViewTextBoxCell
        cell.Value = ComboBox3.GetItemText(ComboBox3.SelectedItem)
        row.Cells.Add(cell)

        cell = New DataGridViewTextBoxCell
        cell.Value = ComboBox4.GetItemText(ComboBox4.SelectedItem)
        row.Cells.Add(cell)

        ' And so on

        DataGridView1.Rows.Add(row)

We also need to add two lines to the SaveToFile method:

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
                ' This makes sure that only rows with data in it gets read.
                If row.IsNewRow = False Then
                    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()
                    line &= ";" & row.Cells(4).Value.ToString()
                    line &= ";" & row.Cells(5).Value.ToString()
                    line &= ";" & row.Cells(6).Value.ToString()
                    line &= ";" & row.Cells(7).Value.ToString()

                    ' This line was missing and also why the file was empty
                    sw.WriteLine(line)
                End If
            Next
            sw.Flush()
            sw.Close()
        End If
    End Sub

As for the form closing code.
The way you have coded it will always ask whether or not you would like to save.
Add …

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

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

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

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

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

Try replacing some of the code with this:

Dim cn As New System.Data.SqlClient.SqlConnection("your connectionstring")
            cn.Open()
            Dim getUser As New System.Data.SqlClient.SqlCommand("select Username from MegaUsers where username=?", cn)
            getUser.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Username", strmegaun))
            Dim resultsReader As System.Data.SqlClient.SqlDataReader
            resultsReader = getUser.ExecuteReader(CommandBehavior.CloseConnection)
            If resultsReader.HasRows Then
                While resultsReader.Read()
                    Response.Write(resultsReader("Username").ToString())
                End While
            End If
            resultsReader.Close()
            resultsReader = Nothing
carrzkiss commented: Thank you so much, 3 days worth of searching, for this one post! You Rock! Keep it up! Carrzkiss +3
Oxiegen 88 Basically an Occasional Poster Featured Poster

Most likely problem lies within the DownloadFile method.
Perhaps it's the WebClient that doesn't have access to the file your'e trying to download.
Try adding some credentials to the client.

Dim cli As System.Net.WebClient
            cli.Credentials = New System.Net.NetworkCredential("username", "password")
            cli.DownloadFile("url to file", "local file")
Oxiegen 88 Basically an Occasional Poster Featured Poster

Ah. I'm sorry. Try this instead.

WebBrowser1.Document.All("body_plain").SetAttribute("value", Body1)
Webbrowser1.Document.InvokeScript("modified", New Object() {"body_plain", True})
WebBrowser1.Document.All("keywords").SetAttribute("value", KeyWords)
Webbrowser1.Document.InvokeScript("modified", New Object() {"keywords"})

Here's my reference: http://www.dotnetcurry.com/ShowArticle.aspx?ID=194&AspxAutoDetectCookieSupport=1

Oxiegen 88 Basically an Occasional Poster Featured Poster

Well. That's a "just in case" scenario.
If you happen to put the code another event than the listbox's SelectedIndexChanged event, it would be useful to have that just in case no item has been selected from the second listbox.

Oxiegen 88 Basically an Occasional Poster Featured Poster

If the items in the three listboxes share the same index, you can use the SelectedIndex property.

If listbox2.SelectedIndex > -1 Then
   listbox1.SelectedIndex = listbox2.SelectedIndex
   listbox3.SelectedIndex = listbox2.SelectedIndex
End If
Oxiegen 88 Basically an Occasional Poster Featured Poster

See what happens if you add the lines in red.

WebBrowser1.Document.All("body_plain").SetAttribute("value", Body1)
Webbrowser1.Document.InvokeScript("modified('body_plain',true)")
WebBrowser1.Document.All("keywords").SetAttribute("value", KeyWords)
Webbrowser1.Document.InvokeScript("modified('keywords')")
Oxiegen 88 Basically an Occasional Poster Featured Poster

Assuming that your DataGridView is called dgv, then this should do the trick.

Private Sub dgv_CellValueChanged(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles dgv.CellValueChanged
        For i As Integer = 0 To dgv.Rows.Count - 1
            lblPlayerScore1.Text += dgv.Rows(i).Cells(0)
            lblPlayerScore2.Text += dgv.Rows(i).Cells(1)
            lblPlayerScore3.Text += dgv.Rows(i).Cells(2)
            lblPlayerScore4.Text += dgv.Rows(i).Cells(3)
            lblPlayerScore5.Text += dgv.Rows(i).Cells(4)
            lblPlayerScore6.Text += dgv.Rows(i).Cells(5)
            lblPlayerScore7.Text += dgv.Rows(i).Cells(6)
            lblPlayerScore8.Text += dgv.Rows(i).Cells(7)
            lblPlayerScore9.Text += dgv.Rows(i).Cells(8)
            lblPlayerScore10.Text += dgv.Rows(i).Cells(9)
            lblPlayerScore11.Text += dgv.Rows(i).Cells(10)
            lblPlayerScore12.Text += dgv.Rows(i).Cells(11)
        Next
    End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster
txtBox1.Text = webbrowser1.Document.GetElementById("sample").InnerHtml
Oxiegen 88 Basically an Occasional Poster Featured Poster

By using the property InnerHTML.

Oxiegen 88 Basically an Occasional Poster Featured Poster

e.ClientMousePosition is the position of the mouse pointer depending on the client area, ie the webbrowser control.
So I'm thinking that it's not possible. Or at the very least very very difficult. :|

I'm also thinking that you might have to use the code snippets I've provided to find all clickable elements in the document.
Iterate throgh them until you find one you're looking for and extract the link.
You can then use that link to create an URI object and navigate to it. webbrowser1.Navigate(New Uri("http://a_link"))

Oxiegen 88 Basically an Occasional Poster Featured Poster

Oh, I misunderstood.
The code i provided can only give you the coordinates of where You clicked.
I don't think it's possible to send a click to the browser by coordinates.
Unless someone else has a brilliant idea of how to do that.

Oxiegen 88 Basically an Occasional Poster Featured Poster
' Private class variable to get Document from WebBrowser control.
    Private WithEvents _document As HtmlDocument

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        _document = WebBrowser1.Document
    End Sub

    Private Sub _document_Click(ByVal sender As Object, ByVal e As HtmlElementEventArgs) Handles _document.Click
        '' Here's the coordinates
        'e.ClientMousePosition
        Dim htmlElement As HtmlElement = _document.GetElementFromPoint(e.ClientMousePosition)
        If htmlElement.GetAttribute("").Contains("") Then
            TextBox.Text = htmlElement.GetAttribute("")
        End If
    End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

Well. Considering that a page might hold a number of this kind of tags it could prove to be a challenge.
You can use the same technique as I showed you and iterate through all the GetElementsByTagName("img") elements.
And you might have to provide some logic inside the loop to find the specific image you're looking for.

Dim htmlElements As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("img")
        Dim imgList As List(Of String)
        For Each el As HtmlElement In htmlElements
            ' Provide additional logic if necessary
            If Not el.GetAttribute("src").Contains("sample") Then
                TextBox.Text = el.GetAttribute("src")
            End If
        Next
Oxiegen 88 Basically an Occasional Poster Featured Poster

Answered in the PM you also sent.

Oxiegen 88 Basically an Occasional Poster Featured Poster
Dim htmlElements As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("input")

        For Each el As HtmlElement In htmlElements
            If el.GetAttribute("name").Equals("sample") Then
                TextBox.Text = el.GetAttribute("value")
            End If
        Next
Oxiegen 88 Basically an Occasional Poster Featured Poster

Is the Access database local on you machine or is it placed on a network share?
If it's local then you need to include the .MDB file in the deployment project so that it too is copied along with your application.

What tool are you using to create a setup?

Oxiegen 88 Basically an Occasional Poster Featured Poster

Perhaps something like this:

If txtSearch.Text.Equals("") Then
                PurchaseDt.DefaultView.RowFilter = ""
        Else
                PurchaseDt.DefaultView.RowFilter = "PUrchaseID=" & Integer.Parse(txtSearch.Text)
        End If
Oxiegen 88 Basically an Occasional Poster Featured Poster

Guyz I need help.. I'm a newbie in vb.net 2008..I have a form for User Account Maintenance and I want to transfer the Data of the specified Cell of the Datagridview once it's selected by clicking the mouse. How can I transfer it to textbox? Please help me.

DataGridView has an event called CellClick.
You can use that to extract the value of the cell you clicked.
Ex:

Private Sub dgv_CellClick(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles dgv.CellClick
        txtBox.Text = dgv.Item(e.ColumnIndex, e.RowIndex).Value.ToString
    End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

First. If you are using a Primary Key in Access 2000, then you don't need to provide that in your INSERT statement.
Access 2000 automatically adds a new record with a new Primary Key value.
That makes all the records in the database unique.

Second. There is probably a very clever way of doing what you ask for.
But this is how I would do it.

Create a method that takes any number of arguments that you need to identify a record as unique and has a return value type of Boolean.
Read the database from this method, and if the record exists, as defined by the supplied arguments, then the method should return true.

Private Function RecordExists(ByVal value1 As String, ByVal value2 As String....) As Boolean
            Dim bolReturnValue As Boolean = False
            Dim reader As OleDbDataReader
            Mycn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\ameya\WindowsApplication2\portfolio.mdb")
            Mycn.Open()
            SQLstr = String.Format("SELECT * FROM p1 WHERE col1 = '{0}' AND col2 = '{1}'", value1, value2)
            Command = New OleDbCommand(SQLstr, Mycn)
            reader = Command.ExecuteReader(CommandBehavior.CloseConnection)
            If reader.HasRows Then
                        bolReturnValue = True
            End If
            reader.Close()

            return bolReturnValue
End Function

Call this method from your Add button event before you execute the code for storing a new record. If Not RecordExists(TextBox1.Text, TextBox2.Text) Then 'Code for storing