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.Custom ersDataTable
Dim _dr As DataSet1.Custom ersRow
Dim arrText() As String
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
SqlDataAdapter1 .Fill(DataSet11 )
_dt = DataSet11.Custo mers
ListBox1.DataSo urce = _dt
ListBox1.Displa yMember = "ContactNam e"
ListBox1.ValueM ember = "CustomerID "
_postBack = True
End Sub
Private Sub ListBox1_Select edValueChanged( ByVal sender As Object, ByVal
e As System.EventArg s) Handles ListBox1.Select edValueChanged
If _postBack = True Then
_dr = _dt.FindByCusto merID(ListBox1. SelectedValue)
FillArray()
TextBox1.Text = arrText(0)
TextBox2.Text = arrText(1)
End If
End Sub
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
_dr.ContactName = arrText(0) & " " & arrText(1)
MessageBox.Show ("Done.")
End Sub
Private Sub FillArray()
arrText = Split(_dr.Conta ctName, " ")
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
"Cor Ligthert" wrote:
Rodchar,
Have a look for databinding and currencymanager for that (it is in the
snippet I showed you with the textbox)
http://msdn.microsoft.com/library/de...classtopic.asp
http://msdn.microsoft.com/library/de...ClassTopic.asp
That is a better approach.
I hope this helps?
Cor
"rodchar"
Here's some of my syntax:
private sub Save
m_dr.BeginEdit( ) 'This works
m_dr.Codes = strHold 'This works
m_dr.EndEdit() 'This does not work
End Sub
"rodchar" wrote:
Hey all,
I thought what I was doing was pretty straightforward but apparently not.
All I'm doing is loading a datarow, letting the user modify a field in
the
datarow by inputing into a textbox. I then take that textbox and assign
the
datarow field that value.
But, as soon as the assignment occurs the datarow becomes nothing. And I
have no idea why.
thanks in advance,
rodchar