473,498 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A clearly instansiated object (a WebForm control) isn't instansiat

Hello,
When clicking on a button the selected item from the 1st listbox is supposed
to be added to the 2nd listbox:
The code:
Private Sub btnInfo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnInfo.Click
Dim sVal As String
Me.lstKatInfo.SelectedIndex = -1
sVal = Me.lstKat.SelectedItem.Text
Me.lstKatInfo.Items.Add(sVal)
End Sub

When I enter text values in the first listbox everything works fine, but
when the
listbox items are added in the Page_Load event from a DataTable
this problems occurs.
Any ideas?

Thanks in advance,
Kristian
Nov 19 '05 #1
1 1117

Kristian:
Are you rebinding the listbox on postback? My guess is that you are, and
therefore the user's selection is being overwritten with blank.

if not page.IsPOstBack then
lstKat.DataSource = myDataTable
lstKat.DataBind()
end if

also, in your btnInfo_Click you rally should make sure that there is a
selected item before retriving it's text...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Kristian" <Kr******@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
Hello,
When clicking on a button the selected item from the 1st listbox is supposed to be added to the 2nd listbox:
The code:
Private Sub btnInfo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnInfo.Click
Dim sVal As String
Me.lstKatInfo.SelectedIndex = -1
sVal = Me.lstKat.SelectedItem.Text
Me.lstKatInfo.Items.Add(sVal)
End Sub

When I enter text values in the first listbox everything works fine, but
when the
listbox items are added in the Page_Load event from a DataTable
this problems occurs.
Any ideas?

Thanks in advance,
Kristian

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3323
by: deko | last post by:
I'm hoping someone can sanity check my understanding of the Object Model for Forms/Controls. I'm having trouble drilling down into Control properties. First, I have a record set with the...
3
1667
by: Ray | last post by:
Hi folks, I have two Vis Basic projects, one creates a dll, the other an ocx. I compile them both. Then I drop the ocx activex object onto a Microsoft Access 2002 form: it works fine. In another...
2
6162
by: Levis | last post by:
Hi, I inherited Button and I created my component (MyButton) In this button onclick event I want show this objects parent form. When my form is not MDIChild this codes run correct. But when my...
1
1640
by: Tina | last post by:
I am trying to adjust the size of an image web control but if I try to say myimage.height = 200 it says that an integer cannot be converted to a webcontrol unit. I also tried a ctype cast but that...
3
1223
by: Harry | last post by:
Dear all, It is found that when a webform control trigger an event, Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub This...
3
1152
by: Arne | last post by:
How do I make a web form control react to a client side event in the browser THe onclick event to server based. I am looking for onclick event on the client I need something like this from a...
0
1444
by: mimo | last post by:
Hello, This is a really easy asp.net 2.0 question that some how I am missing. How do I bind a label to a field in an object datasource control? Thanks!
2
1474
by: cherylwpy | last post by:
I have a windows form ActiveX used for connecting remote servers. It is related to a video streaming interface (as I am a system integrator, I don't know what technology they actually used). ...
0
3143
by: hott5hotj | last post by:
in Actionscript 3.0 Ive created a datagrid that populated with data. I want to create a pop up window to confirm whether the removal of an entry. When I call from the child object the following, I...
0
7125
marktang
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,...
0
7165
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6885
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...
0
5462
agi2029
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,...
1
4908
isladogs
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...
0
4588
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1417
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.