Hey Everyone,
Cor, thanks for the articles. I glanced over them and they might be a little
over my head at this time.
Can you take a look at the following code:
Dim _postBack As Boolean = False
Dim _dt As DataSet1.CustomersDataTable
Dim _dr As DataSet1.CustomersRow
Dim arrText() As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
SqlDataAdapter1.Fill(DataSet11)
_dt = DataSet11.Customers
ListBox1.DataSource = _dt
ListBox1.DisplayMember = "ContactName"
ListBox1.ValueMember = "CustomerID"
_postBack = True
End Sub
Private Sub ListBox1_SelectedValueChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles ListBox1.SelectedValueChanged
If _postBack = True Then
_dr = _dt.FindByCustomerID(ListBox1.SelectedValue)
FillArray()
TextBox1.Text = arrText(0)
TextBox2.Text = arrText(1)
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
_dr.ContactName = arrText(0) & " " & arrText(1)
MessageBox.Show("Done.")
End Sub
Private Sub FillArray()
arrText = Split(_dr.ContactName, " ")
End Sub
Can you tell me if this is the way to update the contact name?
To run, using Northwind database.
All you need is 1 listbox, 2 textboxes, and a button.
I used all default names.
I used the SqlDataAdapter wizard to get all Customers.
I also generated a typed dataset and added an instance called Dataset1
Goal: All I want to do is update the contact name. I split the first and
last name into textboxes for update and hit save.
It's not working quite right, do you see anything?
thanks in advance,
rodchar