Hey all,
I've the following code:
Dim _postBack As Boolean = False
Dim _ds As New DataSet1
Dim _dt As DataSet1.CustomersDataTable
Dim _dr As DataSet1.CustomersRow
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
SqlDataAdapter1.Fill(_ds)
_dt = _ds.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
MessageBox.Show("Finding customer...")
_dr = _dt.FindByCustomerID(ListBox1.SelectedValue)
TextBox1.Text = _dr.ContactName
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
_dr.ContactName = TextBox1.Text
MessageBox.Show(_dr.RowState.ToString)
End Sub
Why?, when I click the Button1, does the ListBox1_SelectedValueChanged run?
To recreate:
All you need is Northwind.
I used the SqlDataAdapter wizard
Generated a typedDataset(no instance) 4 1426
Since the listbox is databound, the index will change on filling the
dataset. http://groups.google.com/groups?th=fa80dc67a61f9228
(look for a workaround in the posts above)
Imran.
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:65**********************************@microsof t.com... Hey all,
I've the following code:
Dim _postBack As Boolean = False Dim _ds As New DataSet1 Dim _dt As DataSet1.CustomersDataTable Dim _dr As DataSet1.CustomersRow
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load SqlDataAdapter1.Fill(_ds) _dt = _ds.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 MessageBox.Show("Finding customer...") _dr = _dt.FindByCustomerID(ListBox1.SelectedValue) TextBox1.Text = _dr.ContactName End If End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click _dr.ContactName = TextBox1.Text MessageBox.Show(_dr.RowState.ToString) End Sub
Why?, when I click the Button1, does the ListBox1_SelectedValueChanged
run? To recreate: All you need is Northwind. I used the SqlDataAdapter wizard Generated a typedDataset(no instance)
Do you know how I can utilize my _postBack flag to make this work?
"Imran Koradia" wrote: Since the listbox is databound, the index will change on filling the dataset. http://groups.google.com/groups?th=fa80dc67a61f9228 (look for a workaround in the posts above)
Imran.
"rodchar" <ro*****@discussions.microsoft.com> wrote in message news:65**********************************@microsof t.com... Hey all,
I've the following code:
Dim _postBack As Boolean = False Dim _ds As New DataSet1 Dim _dt As DataSet1.CustomersDataTable Dim _dr As DataSet1.CustomersRow
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load SqlDataAdapter1.Fill(_ds) _dt = _ds.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 MessageBox.Show("Finding customer...") _dr = _dt.FindByCustomerID(ListBox1.SelectedValue) TextBox1.Text = _dr.ContactName End If End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click _dr.ContactName = TextBox1.Text MessageBox.Show(_dr.RowState.ToString) End Sub
Why?, when I click the Button1, does the ListBox1_SelectedValueChanged run? To recreate: All you need is Northwind. I used the SqlDataAdapter wizard Generated a typedDataset(no instance)
Is this an ASP.NET project? I'm not sure what the _postBack flag does. Is
this a variable you've created? If you are using the variable for something
else then I would suggest you create a new variable as mentioned in the link
I sent. Any reason why you cant do it that way?
Imran.
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:D1**********************************@microsof t.com... Do you know how I can utilize my _postBack flag to make this work?
"Imran Koradia" wrote:
Since the listbox is databound, the index will change on filling the dataset. http://groups.google.com/groups?th=fa80dc67a61f9228 (look for a workaround in the posts above)
Imran.
"rodchar" <ro*****@discussions.microsoft.com> wrote in message news:65**********************************@microsof t.com... Hey all,
I've the following code:
Dim _postBack As Boolean = False Dim _ds As New DataSet1 Dim _dt As DataSet1.CustomersDataTable Dim _dr As DataSet1.CustomersRow
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load SqlDataAdapter1.Fill(_ds) _dt = _ds.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 MessageBox.Show("Finding customer...") _dr = _dt.FindByCustomerID(ListBox1.SelectedValue) TextBox1.Text = _dr.ContactName End If End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click _dr.ContactName = TextBox1.Text MessageBox.Show(_dr.RowState.ToString) End Sub
Why?, when I click the Button1, does the ListBox1_SelectedValueChanged run? To recreate: All you need is Northwind. I used the SqlDataAdapter wizard Generated a typedDataset(no instance)
Rodchar,
I have looked at your code, without testing it, had no time anymore to do it
real good, and therefore I did want to try it today, however I see now that
your question is resolved.
About the postback my question was exactly the same as from Imran even
before you posted this message.
Cor
"rodchar" <ro*****@discussions.microsoft.com> Do you know how I can utilize my _postBack flag to make this work?
"Imran Koradia" wrote:
Since the listbox is databound, the index will change on filling the dataset. http://groups.google.com/groups?th=fa80dc67a61f9228 (look for a workaround in the posts above)
Imran.
"rodchar" <ro*****@discussions.microsoft.com> wrote in message news:65**********************************@microsof t.com... > Hey all, > > > I've the following code: > > Dim _postBack As Boolean = False > Dim _ds As New DataSet1 > Dim _dt As DataSet1.CustomersDataTable > Dim _dr As DataSet1.CustomersRow > > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > SqlDataAdapter1.Fill(_ds) > _dt = _ds.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 > MessageBox.Show("Finding customer...") > _dr = _dt.FindByCustomerID(ListBox1.SelectedValue) > TextBox1.Text = _dr.ContactName > End If > End Sub > > Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles Button1.Click > _dr.ContactName = TextBox1.Text > MessageBox.Show(_dr.RowState.ToString) > End Sub > > Why?, when I click the Button1, does the ListBox1_SelectedValueChanged run? > > To recreate: > All you need is Northwind. > I used the SqlDataAdapter wizard > Generated a typedDataset(no instance) > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: |
last post by:
Hi,
I am setting the NumericUpDown .Value property and the ValueChanged event
is NOT being fired. Does this ONLY get fired when I change it on the UI and
not programatically?
Thanks
|
by: Sampriti |
last post by:
I am trying to delete a file from a disk when the user's
session ends. So I am putting my file.delete code in
Session_End event. I ran the application in the debug
mode. When the session timesout...
|
by: dina |
last post by:
I am using one main aspx page, in which i am loading different user
controls for different web pages. At one place, when i load a user
control from another user control and come back to the same...
|
by: Ram |
last post by:
I have a start page for my application default.htm which contains four
frames.
header.htm
login.aspx
rightside.htm
footer.htm
login.aspx conatins username, password fields and login button....
|
by: Paul |
last post by:
Hi,
In a class i built, i fire an event when a field changes. In a webform that
has an instance of the class, the event (from the class) is fired and the
code is executed. However, my webpage...
|
by: Datagridtextboxcolumn not firing event |
last post by:
"PLEASE HELP, I NEED HELP N O W !!!"
AddHandler dgtxtboxcolumn.textbox.KeyDown, AddressOf TextBoxKeyPress
Private Sub TextBoxKeyPress(ByVal sender as Object, ByVal e as
KeyEventArgs)
End...
|
by: thedotnetarchitect |
last post by:
Can anyone tell me why my page load event is firing more then once? I
have a asp.net 2.0 page with four user controls and it seems that the
user controls are loading but the page load event seems...
|
by: Kevin Attard |
last post by:
I am using a GridView inside a UserControl which has a template column for
deleting the rows. Before databinding the gridview i am attaching the
RowCommand and RowDataBound event.
I am using the...
|
by: bigijoseph |
last post by:
Please help : page load event is not firing.
--------------------------------------------------------------------------------
Hi,
I am a new to .net. I am trying to learn it.
I tried the...
|
by: John007 |
last post by:
I am using a SQLDataSource to populate my gridview in ASP.Net 2.0. When I hit Edit, the textboxes appear and I am able to edit my values. When I hit Update, the changes are not saved, and there is no...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |