Oxiegen 88 Basically an Occasional Poster Featured Poster

Take a look at this thread, it might be of some use: http://www.daniweb.com/forums/thread106940.html

Oxiegen 88 Basically an Occasional Poster Featured Poster
Dim FontName As String = "Arial"
Dim FontSize As Integer = 14
Dim FS As New Font(FontName, FontSize, FontStyle.Regular)
Me.Font = FS
Oxiegen 88 Basically an Occasional Poster Featured Poster

Have a look at this discussion: http://www.vbforums.com/showthread.php?t=358556

Oxiegen 88 Basically an Occasional Poster Featured Poster

I found some things that you might wanna look at.
If for example the files csvSAVINGS.TXT or csvCHECKING.TXT does not exists then you might wanna change some of the code for the file reading.

In the method CalcBalance, in the Account class, you cannot ReDim m_transSet if the variable x is -1.
When ReDim'ing you have to state the amount of positions in the array to use. Meaning, if the size of the array is supposed to be 1 then the variable x must be declared as 1, not 0 or -1. ReDim variable(<number of positions to declare>) My next suggestion is to check the state of m_transSet in the Balance property:

Public ReadOnly Property Balance() As Double
        Get
            If m_transSet IsNot Nothing Then
               Return m_transSet(m_transSet.Length - 1).NewBalance
            Else
               Return <a default number if all failes>
            End If
        End Get
    End Property
Oxiegen 88 Basically an Occasional Poster Featured Poster

Yes, I understand. Perhaps I formulated myself a bit unclear.

Based on what I can see in the code-snippet you provided is that no matter what value tempckL has (1, 2 or 3), that is the position in the array you will select a value from.

That said, there is really no need for a large IF...ELSE IF-statement to check for every possible value tempckL can have, because it's redundant.

As long as tempckL is either 1, 2 or 3 (or greater?) then all you need to do is assign the values in the array to your labels. Hence my smaller IF statement.

Take a closer look at your IF statement and tell me if I'm wrong.

Since I don't know how the rest of the code looks like and a loop really is called for, then perhaps something like this:

'Loop the rounds 1 through 3
For i As Integer = 1 To 3
   sBBox.Text = arrSB(i - 1)
   lBBox.Text = arrLB(i - 1)
   nSBBox.Text = arrSB(i)
   nLBBox.Text = arrLB(i)
Next

This will put different values in the labels at a very quick rate.

Oxiegen 88 Basically an Occasional Poster Featured Poster
Oxiegen 88 Basically an Occasional Poster Featured Poster

From what I can see of your IF statement is that no matter what tempckL is, you always set your labels to the same thing.
So what do you need either IF statements or loops for?

Although, perhaps you should consider a small IF statement.

If tempckL > 0 Then
   sBBox.Text = arrSB(tempckL - 1)
   lBBox.Text = arrLB(tempckL - 1)
   nSBBox.Text = arrSB(tempckL)
   nLBBox.Text = arrLB(tempckL)
Else
   sBBox.Text = ""
   lBBox.Text = ""
   nSBBox.Text = ""
   nLBBox.Text = ""
End If
Oxiegen 88 Basically an Occasional Poster Featured Poster
Oxiegen 88 Basically an Occasional Poster Featured Poster

Perform ALT + <menu shortcut> so that the menu appears.
Then, while still holding down the ALT key, press PrintScreen.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Loop through the Kalkyle1DataSet.Tables("Ordre").Rows collection until you find the row containg the foreign key you are looking for.
Then you can use the method Remove to remove the row from the table.
Note that I've chosen to run the loop backwards in order to maintain the zero-based collection.

Dim row As DataRow

For i As Integer = Kalkyle1DataSet.Tables("Ordre").Rows.Count -1 To 0 Step -1
   If Kalkyle1DataSet.Tables("Ordre").Rows(i).Item("Ordedato") = <your number> Then
      row = Kalkyle1DataSet.Tables("Ordre").Rows(i)
      Kalkyle1DataSet.Tables("Ordre").Rows.Remove(row)
   End If
Next
Kalkyle1DataSet.Tables("Ordre").AcceptChanges()
Oxiegen 88 Basically an Occasional Poster Featured Poster

Here you first call the ReadFile method and do a bunch of things.
So far so good.

calc.ReadFile(nameOfAccount, listDisplay)
        txtBalance.Text = FormatCurrency(calc.Balance)

However in the ReadFile method I noticed something.

Sub ReadFile(ByVal NameofAccount As String, ByRef listDisplay As ListBox)
        Dim fmtStr As String = "{0,-10} {1,-30}{2,20:c} {3, 10}"
        Dim tran As Transaction
        Dim x As Integer = 0
        Dim sr As StreamReader = Nothing
        If NameofAccount = "Savings" Then
            sr = File.OpenText("csvSAVINGS.TXT")
        Else 'If NameofAccount = "Checking" Then 
            sr = File.OpenText("csvCHECKING.TXT")
        End If
What happens if sr.Peek actually equals -1?
        Do While (sr.Peek <> -1)
            tran = New Transaction
            fileInput = sr.ReadLine.Split(","c)
            tran.TransactionDate = fileInput(0)
            tran.DepoOrWith = fileInput(1)
            tran.TransactionAmount = fileInput(2)
            tran.PreviousBalance = fileInput(3)
            ReDim Preserve m_transSet(x)
            m_transSet(x) = tran
            listDisplay.Items.Add(String.Format(fmtStr, tran.TransactionDate.ToShortDateString, tran.DepoOrWith, _
            FormatCurrency(tran.TransactionAmount) & " PREV BAL", FormatCurrency(tran.PreviousBalance) & _
            " New BAL" & FormatCurrency(tran.NewBalance)))
            x += 1
            tran = Nothing
        Loop
        sr.Close()
    End Sub

So, if the class variable m_transSet is not set then you will get a null reference error.
Try changing the order of the code so that m_transSet is always not null.

Sub ReadFile(ByVal NameofAccount As String, ByRef listDisplay As ListBox)
        Dim fmtStr As String = "{0,-10} {1,-30}{2,20:c} {3, 10}"
        Dim tran As Transaction
        Dim x As Integer = 0
        Dim sr As StreamReader = Nothing
        If NameofAccount = "Savings" Then
            sr = File.OpenText("csvSAVINGS.TXT")
        Else 'If NameofAccount = "Checking" Then 
            sr = File.OpenText("csvCHECKING.TXT")
        End If
        ReDim m_transSet(x)
        Do While (sr.Peek <> -1)
            tran = New Transaction
            fileInput = sr.ReadLine.Split(","c) …
Oxiegen 88 Basically an Occasional Poster Featured Poster
Oxiegen 88 Basically an Occasional Poster Featured Poster

As you probably know, viruses is not always a separate file with a file-extension but is mostly a part of an existing file on your computer as an "intruder".
That said, take a look at this threat database: http://vil.nai.com/vil/default.aspx. Here you can find almost(?) all known viruses with their name and what they do.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Move the declaration of the variable Dim numRowsFilled As Integer outside the Form_Load event and make it Private, thus making it a class variable.
Then it will be available from any event or method only within the class.

Oxiegen 88 Basically an Occasional Poster Featured Poster

How can i make, that program will name .txt file like "29.3.20010.txt"?

Try this: (FileMode.Append will open the file if it exists and continue writing at the end, or create a new file.)

Dim fileName As String = DateTime.Now.ToString("dd.M.yyyy")
Dim file As System.IO.FileStream = New System.IO.FileStream ("C:\Key\" & fileName & ".txt", System.IO.FileMode.Append)

all keys are written into medium sized rich text box - but how can i make, that saved text will be in same shape as it was...

The RichTextBox has an overloaded method called SaveFile.
One of it's variants takes a Stream as argument. It will retain the formatting of your RichTextBox.
Like this:

Dim fileName As String = DateTime.Now.ToString("dd.M.yyyy")
Dim file As System.IO.FileStream = New System.IO.FileStream ("C:\Key\" & fileName & ".txt", System.IO.FileMode.Append)
RichTextBox1.Save(file, RichTextBoxStreamType.RichText)
Noob.exe commented: I think it was helpfull and well explained +0
Oxiegen 88 Basically an Occasional Poster Featured Poster

Try this:

First, add a webservice your website with a method to read directory content and also a method to read a selected file into a byte array.

Second, use that webservice in your window app in order to 1) display directorycontent in a listbox/combobox and 2) retrieve the byte array and convert it into a memorystream.

You can then create a HTTP server and inform WMP to stream from http://localhost:port/<something>. Then push your stream to WMP.

Oxiegen 88 Basically an Occasional Poster Featured Poster

First of, jigneshk. This is not your thread. Start a new one if you have a question.
Second. ComboBox's has two methods called FindString and FindStringExact. The second argument tells the method which item to start with in the zero-based list.

ComboBox1.SelectedIndex = ComboBox.FindString("<string to search for>", 0) 'Finds the first item that starts with the specified string
ComboBox1.SelectedIndex = ComboBox.FindStringExact("<exact string to search for>", 0) 'Finds the first item that matches the specified string

how can i search dropdown in vb.net form?
i used sql server 2005

Oxiegen 88 Basically an Occasional Poster Featured Poster

Odd. I can't answer for C#, but VB.NET has by default a namespace called My.
You can check that by typing Imports <your application name>. and in the IntelliSense there should be a selection available called My.

How are you declaring your connectionstring?

Take a look at this.

Oxiegen 88 Basically an Occasional Poster Featured Poster

I was thinking, for your first problem.
Because you use a three space divider between the values from the database for each item in the listbox.
Couldn't you use that piece of knowledge for startindex and length in the SubString method?
That way, these values will always be dynamic.

Dim startIindex As Integer = 0
Dim stringLength As Integer = 0
stringLength = DisplayCustomersListBox.Text.IndexOf("   ")
CustomerIDTextBox.Text = DisplayCustomersListBox.Text.Substring(0, stringLength)
' Get the startindex of the next value separated by "   "
startIndex = DisplayCustomersListBox.Text.IndexOf("   ") + 3
' Get the startindex of the following "   ", counting from the previous one
stringLength = DisplayCustomersListBox.Text.IndexOf("   ", startIndex) 
SurnameTextBox.Text = DisplayCustomersListBox.Text.Substring(startIndex, stringLength)
.....
Oxiegen 88 Basically an Occasional Poster Featured Poster

You can use the My namespace. My.Computer.Name This will get the name of the computer currently running your program.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Use this code for your update (just add the parts in red).

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        OleDbUpdateCommand1 = New System.Data.OleDb.OleDbCommand

        OleDbConnection1 = New System.Data.OleDb.OleDbConnection


        OleDbUpdateCommand1.CommandText = "UPDATE Employees SET Forename = @p1,Surname = @p2,Role = @p3,Email = @p4,Telephone = @p5,Extension = @p6,Mobile =@p7 WHERE EmployeeID = $p8"
        OleDbUpdateCommand1.Connection = Me.OleDbConnection1
        OleDbUpdateCommand1.Parameters.AddWithValue("@p1", ForenameTextBox.Text)
        OleDbUpdateCommand1.Parameters.AddWithValue("@p2", SurnameTextBox.Text)
        OleDbUpdateCommand1.Parameters.AddWithValue("@p3", RoleTextBox.Text)
        OleDbUpdateCommand1.Parameters.AddWithValue("@p4", EmailTextBox.Text)
        OleDbUpdateCommand1.Parameters.AddWithValue("@p5", TelephoneTextBox.Text)
        OleDbUpdateCommand1.Parameters.AddWithValue("@p6", ExtensionTextBox.Text)
        OleDbUpdateCommand1.Parameters.AddWithValue("@p7", MobileTextBox.Text)
        OleDbUpdateCommand1.Parameters.AddWithValue("@p8", EmployeeID.Text)
        OleDbUpdateCommand1.Connection = Me.OleDbConnection1

        OleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\mydatabase.mdb"

        Try

            OleDbConnection1.Open()

            OleDbUpdateCommand1.ExecuteNonQuery()

        Catch ex As OleDb.OleDbException

            MessageBox.Show(ex.ToString)

        End Try

        OleDbConnection1.Close()
        MsgBox("Employee Details Have Now Been Deleted From Database", MsgBoxStyle.OkOnly + MsgBoxStyle.OkOnly)
   

    End Sub
End Class
Oxiegen 88 Basically an Occasional Poster Featured Poster

You're welcome.

Please mark the thread as solved if everything works out.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Wouldn't it be easier to look at the underlying datasource?
For example, if the DataGrid is bound to a DataSet you can loop that to find the values you are looking for.

Dim totalSum As Integer

For i As Integer = 0 To DataSet.Tables(0).Rows.Count - 1
   totalSum += DataSet.Tables(0).Rows(i).Item("Total")
Next

TextBox.Text = totalSum.ToString()
Oxiegen 88 Basically an Occasional Poster Featured Poster

Not unless that part of your program didn't work before.
Because you already SELECT the EmployeeID, all you need to do is use that in your UPDATE query.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Instead of String.Format(...) have you tried DateTime.Now.ToString("<date format string>") .
Where <date format string> can be any combination of date and time formats.

Or perhaps something dirty like this?

Text= <%# Bind(CReviewDate) %>
Text= DateTime.Parse(Text).ToString("yyyy-MM-dd")
Oxiegen 88 Basically an Occasional Poster Featured Poster

I would go with the Server-Client method and use UDP-streaming.
Further I would consider passing an XML-string back and forth through the UDP-stream.
An XML-string is quite small and UDP is perfect for this type of networking.
The game Quake III Arena uses this technique and it has a bit more data flowing to and from the servers.

Take a look at this UDP project.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Have you debugged the code and looked at the property da_test.InsertCommand.CommandText .
It should contain the appropriate SQL query.
Also, you can try putting everything inside a Try...Catch statement to see if the Update command throws any errors.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Do some string manipulation and look for the attribute "target" and/or "onclick=javascript:window.open". If found, remove them from the url string before navigating.

Oxiegen 88 Basically an Occasional Poster Featured Poster

If your listbox already contains items then this should work:

For i As Integer = 0 To lstBox.Items.Count - 1
   lstBox.Items(i) = lstBox.Items(i) & "'"
Next

Or if you need to add ' while adding items then this is the way to go:

lstBox.Items.Add(<some source> & "'")
Oxiegen 88 Basically an Occasional Poster Featured Poster

Try this:

Try
            If listbox1.Items.Count > 0 Then
                If listbox1.SelectedIndices.Count > 0 Then
                    For Each index As Integer In listbox1.SelectedIndices
                        listbox1.Items.RemoveAt(index)
                    Next
                End If
            Else
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
Oxiegen 88 Basically an Occasional Poster Featured Poster

Well. This line STRTotal = STRFinValue + +(STRFinValue) basically says that during the iteration STRTotel is always going to be 2 = 1 + 1 .
If you want STRTotal to change then STRFinValue needs to change inside the iteration.
Or do this: STRTotal += (STRFinValue + STRFinValue) .
This will allow STRTotal to "remember" and increase it's current value with STRFinValue + STRFinValue.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Have you tried using ds_test.AcceptChanges() before updating the database?
Sometimes you need to commit the changes to the dataset before sending it's updated state back to the database.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Add the parts in red.

Public Class ItunesKiller

    Private Sub AddButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddButton.Click
        For Each line As String In SongTextBox.Lines

            SongComboBox.Items.Add(line)

        Next
    End Sub

    Private Sub SongComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles SongComboBox.SelectedIndexChanged
        TextBoxOnTop.Text = SongComboBox.SelectedItem
    End Sub

    Private Sub DeleteButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteButton.Click
        If Not IsIncluded(PlayListBox.SelectedItem) Then
            SongComboBox.Items.Remove(SongComboBox.SelectedItem)
        End If
    End Sub

    Private Sub IncludeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IncludeButton.Click
        PlayListBox.Items.Add(SongComboBox.SelectedItem)
    End Sub

    Private Sub RemoveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveButton.Click
        PlayListBox.Items.Remove(PlayListBox.SelectedItem)
    End Sub

    Private Function IsIncluded(ByVal SongName As String) As Boolean
        If PlayListBox.Items.Contains(SongName) Then Return True
        Return False
    End Function
End Class
Oxiegen 88 Basically an Occasional Poster Featured Poster

Here is what you can do.
First, change the name of the labels that you want to be able to change background color into something that's easy to monitor, like lblBg1, lblBg2 etc...
When that's done you can use adaposts code for looping through the controls.

....
 For Each cnt As Control In Me.Controls
            If TypeOf cnt Is GroupBox Then
                For Each child In cnt.Controls
                    If TypeOf child Is Label Then
                        If CType(child, Label).Name.StartsWith("lblBg") Then
                            If CType(child, Label).BackColor = Color.Red Then
                                CType(child, Label).BackColor = Color.White
                            Else
                                CType(child, Label).BackColor = Color.Red
                            End If
                        End If
                    End If
                Next
            End If
        Next
..
Oxiegen 88 Basically an Occasional Poster Featured Poster

Look further up, almost at the top.
SQL is declared.

However, I noticed an error in the SQL string.
Replace "WHERE UserName=" & txtUserName.Text & "'" with "WHERE UserName='" & txtUserName.Text & "'"

Oxiegen 88 Basically an Occasional Poster Featured Poster

Here it is in VB.NET.
Remember to change all *** into YOUR data source, username and password.

Private Sub btnInsert_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnInsert.Click
	Dim InsertQuery As String = String.Empty
	Dim con1 As SqlConnection = New SqlConnection("Data Source=***;Initial Catalog=master; Persist Security Info=True; User ID=***; Password=***")
	con1.Open()
	Dim ada As SqlDataAdapter = New SdlDataAdapter("SELECT username FROM test123", con1)
	Dim ds As DataSet = New DataSet()
	ada.Fill(ds)
	Dim cmb1 As SqlCommand = Nothing
	
	For j As Integer = 0 To ds.Tables(0).Rows.Count - 1
		InsertQuery = "UPDATE test123 SET balance = " & (10 + j) & " WHERE username = '" & ds.Tables(0).Rows(j).Item("username").ToString() & "'"
		cmd1 = New SqlCommand(InsertQuery, con1)
		cmd1.ExecuteNonQuery()
	Next
	con1.Close()
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

Have a look at these sites:

1) http://www.dreamincode.net/forums/index.php?showtopic=37361
2) http://www.codeproject.com/KB/vb/tracker.aspx

Hello all,
1) I want to know how to use the serial component in the toolbox of VB2008 express edition.
2) I want to how to plot a graph in VB2008 express edition.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Do this instead:

Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click
Dim conn As New OleDbConnection("<connection string>")
Try
   If txtUserName.Text <> "" Then

   Dim SQL As String = "UPDATE addresses SET PinCode= '" & txtPinCode.Text & "' , " & _
"Occupation= '" & txtOccupation.Text & "' , " & _
"Balance='" & txtBalance.Text & "' , " & _
"Age='" & txtAge.Text & "' , " & _
"WHERE UserName=" & txtUserName.Text & "'"

   txtStatus.Text &= vbCrLf & "Sending query: " & SQL

   Dim hasErrors As Boolean = False
   conn.Open()
   Dim com As New OleDbCommand(SQL, conn)
   If com.ExecuteNonQuery = 0 Then
      hasErrors = True
   End If
   conn.Close()

   If Not hasErrors Then
      txtStatus.Text &= vbCrLf & "Query Successful" & vbCrLf
   Else
      txtStatus.Text &= vbCrLf & You may only update an existing record. "
   End If

Catch exception As System.Data.OleDb.OleDbException
   If conn.State = ConnectionState.Open Then
      conn.Close()
   End If
   Console.WriteLine(exception.StackTrace)
   txtStatus.Text &= exception.ToString
End Try
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

Examine the links at the bottom on this page:
http://en.wikipedia.org/wiki/Honeypot_(computing)

Oxiegen 88 Basically an Occasional Poster Featured Poster

Try this:

Private Sub DtpDefault_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DtpDefault.ValueChanged
        Call Connection()
        Dim s As String = Month(Now)
        Dim d As Date = Date.Now
        dsLogin = New DataSet("GymDatDataSet")
        daLogin = New OleDb.OleDbDataAdapter("Select * from fec where Mnth=Month(now) AND EndDt<'" & DtpDefault.Value.ToString("yyyy-MM-dd") & "'", con)
        daLogin.Fill(dsLogin, "fec")
        Dim cr As New CrystalReportFeeDefaulter
        cr.SetDataSource(dsLogin)
        CrystalReportViewer1.ReportSource = cr
        CrystalReportViewer1.Refresh()
    End Sub
End Class

You can change the argument in ToString into whatever format your dates are stored.

Oxiegen 88 Basically an Occasional Poster Featured Poster

(1)
PHP has no real definition, ie: var $a_var;.
In VB.NET you must define what the variable will contain, ie:
Dim a_var As Integer
Dim another_var As String

(2)
PHP uses the C syntax for iterations:
for (var $i = 0; $i < 10; $i++)
{ }
while ($a_var < 10)
{ }

VB.NET:
For i As Integer = 0 To 10
Next
While a_var <= 10
End While

(3)
PHP (again, C syntax):
if ($a_var == $another_var)
{ }
else
{ }

VB.NET:
If a_var = another_var Then
Else
End If

(4)
PHP:
$file = fopen(<file to open>,"r"|"r+"|"w"|"w+"|"a"|"a+"|"x"|"x+");

VB.NET:
Many many ways of manipulating files.
Have a look at the System.IO namespace.
There's the classes File, FileStream, StreamReader, Stream and FileInfo among others.

pls i need the different betwwen Vb.net and PHP looking in the are i listed
Area Visual Basic .Net PHP
(1)Variable definitions
(2)Loops
(3)Conditions
(4)File handling

Oxiegen 88 Basically an Occasional Poster Featured Poster

Try this:

Dim stream As System.IO.FileStream = New System.IO.FileStream(<string path to ini file>, System.IO.FileMode.Open)
Dim treader As System.IO.TextReader = New System.IO.StreamReader(stream)

Dim line As String

While treader.Peek > 0
    line = treader.ReadLine
    '' Add some checking to see if line should be added to the ListBox
    listbox1.Items.Add(line)
End While
treader.Close()
stream.Close()

Well i got my codes so Checkbox and Textbox to read ini but i cant find how to make ListBox read ini like each line in the ini is 1 item on the listbox

i have the api calls thingy and other stuff, but if you have a code or something i could use ill be so happy

Thx in advance

xfrolox commented: Rep for help ^^ +1
Oxiegen 88 Basically an Occasional Poster Featured Poster

Try this in the command buttons click event:

Private buttonClickIndex As Integer = 0

Private Sub Command1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
     If buttonClickIndex = 0 Then
          label1.Text = "hello"
          buttonClickIndex = 1
     ElseIf buttonClickIndex = 1
          label1.Text = "bye"
          buttonClickIndex = 2
     ElseIf buttonClickIndex = 2
          label1.Text = "hi"
          buttonClickIndex = 0
     End If
End Sub

hello
I have strings here, ecah stored individually
a = hello
b = bye
c= hi

Label1.text = a
label1.text = b
label1.text = c
it is in the command button sub and i want them to show respectively when the button is clicked like this:
a first, then b, then c.

Oxiegen 88 Basically an Occasional Poster Featured Poster

In your SELECT query you need to also extract the record ID and use that in a WHERE-clause for your UPDATE query. UPDATE TableName set col1=@p1,col2=@p2 where col3=@p3 WHERE RecordID = <some_number>

Oxiegen 88 Basically an Occasional Poster Featured Poster

Perhaps something like this.
The check should be performed after the query.

Me.NamesTableAdapter.FillByName(Me.DataSet.Names, Me.ForenameTextBox.Text, Me.ForenameTextBox.Text, Me.SurnameTextBox.Text, Me.SurnameTextBox.Text, Me.RoleTextBox.Text, Me.RoleTextBox.Text)

If Me.DataSet.Names.Rows.Count > 0 Then
        Dim frm As New Staff
        frm.SetEmployeeData(Me.DataSet.Names)
        frm.Show()
Else
        MessageBox.Show("No records found")
End If
        Me.Close()
Oxiegen 88 Basically an Occasional Poster Featured Poster

One difference between C and VB is that C is case-sensitive, which means that variables can have the same name as properties as long as they differ in how you write them: int a_var is not the same as int A_var.

With that in mind, notice that the variables are set in the clone method in the C# class, not the properties.

Oxiegen 88 Basically an Occasional Poster Featured Poster

If you use a DataReader then the answer is quite easy.
The reader has a property called HasRows that indicates whether or not the database query was successful, or not.
Put the code for opening the form inside an If DataReader1.HasRows = True Then statement, and the code for displaying a MessageBox inside an Else statement.

If you're using the DataAdapter method and use that to fill a DataSet then you can check either DataSet1.Tables.Count or DataSet1.Tables(0).Rows.Count.

i have sucessfully coded my form so that when a user enters data into the texxt box and searches any matching data is displayed on another form my problem is when no data matches the search criteria the form that would display the result still opens but is blank how do i create a message that tells the user there is no matching crieria and stop the other form from opening?

Oxiegen 88 Basically an Occasional Poster Featured Poster

Move the line Dim newOrdreRow As DataRow = Kalkyle1DataSet.Tables("Ordre").NewRow() so that it's inside the third iteration, just above the line newOrdreRow("OrdreID") = MaxID (this is for fixing the error message).
And add the line Kalkyle1DataSet.AcceptChanges() just after the iteratation.
Also, if OrdreID is the unique identifier you need to increment it on every itereration. Not just once before you start to copy records.
So, change the line newOrdreRow("OrdreID") = MaxID to

MaxID += 1
newOrdreRow("OrdreID") = MaxID
Oxiegen 88 Basically an Occasional Poster Featured Poster

I would do this instead in the Timer_Tick event:

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick


        If ProgressBar1.Value >= ProgressBar1.Maximum Then
            ProgressBar1.Value = ProgressBar1.Minimum
            Timer1.Enabled = False
        Else
            ProgressBar1.Increment(2)    '' Notice the difference?
            If ProgressBar1.Value >= ProgressBar1.Maximum Then
                        ProgressBar1.Value = ProgressBar1.Maximum
                        Timer1.Enabled = False
            End If
            lblmsg.Text = "Percentage Complete : " & ProgressBar1.Value & "%"
        End If
    End Sub

Redundacy is sometimes a good thing.

Oxiegen 88 Basically an Occasional Poster Featured Poster

In your code where you add a new customer, remember to also include "DeleteFlag = False" in your SQL for storing the customer. INSERT INTO CustomerTable (......,DeleteFlag) VALUES (......,False) Add or change the code written i red:

Private Sub DisplayItems(ByVal num As Integer)
'Loads recordset & outputs to list box

Dim ConnectionString As String
Dim SQLString As String
Dim TitleString As String = " "
Dim conn As System.Data.OleDb.OleDbConnection
Dim dr As System.Data.OleDb.OleDbDataReader
Dim cmd As System.Data.OleDb.OleDbCommand

ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data "
ConnectionString += "Source=" & "Opticians.accdb "

conn = New System.Data.OleDb.OleDbConnection(ConnectionString)

'Access the fields
SQLString = "SELECT CustomerID,Surname,Forename FROM CustomerTable WHERE DeletedFlag=false OR DeletedFlag IS NULL"
Try 'was database found etc.

cmd = New System.Data.OleDb.OleDbCommand(SQLString, conn)
conn.Open()

If (ConnectionState.Open.ToString = "Open") Then

dr = cmd.ExecuteReader()

If dr.HasRows Then
DisplayCustomersListBox.Items.Clear()

While dr.Read
If Not IsDBNull(dr.Item("CustomerId")) Then
TitleString += dr.Item("CustomerID") & " "
TitleString += dr.Item("Surname") & " "
TitleString += dr.Item("Forename") & " "

DisplayCustomersListBox.Items.Add(TitleString)

End If
End While
End If
End If

Catch
MessageBox.Show("Error accessing database")
End Try
conn.Close()
DisplayCustomersListBox.Items.Add(" ")
DisplayCustomersListBox.Items.Add("Count:" & DisplayCustomersListBox.Items.Count - 1)

End Sub

Private Sub DisplayCustomersListbox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisplayCustomersListBox.SelectedIndexChanged
Dim ConnectionString As String
Dim SQLString As String
Dim cmd As System.Data.OleDb.OleDbCommand
Dim conn As System.Data.OleDb.OleDbConnection
Dim dr As System.Data.OleDb.OleDbDataReader
ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data "
ConnectionString += "Source=" & "CarRentalsSystem.accdb …