I have a combox which populated list of all course from the database with the following code:
Dim CourseTable As New DataSet
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
' connection string hard coded require immediate attention if file path changed from F to something else
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Dim SqlConnection As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=F:\G677Lite_03-04-12\Trading_Floor_11-01-12\App_Data\Trading_Floor.mdf;Integrated Security=True;User Instance=True")
' Dim SqlCommand As New SqlCommand("Select * from Course", SqlConnection)
' for improved secuirty populate course table based on query written in the stored procedure
Dim SqlCommand As New SqlCommand("sproc_Course_GetAll", SqlConnection)
Dim MySqlDataAdapter As New SqlDataAdapter(SqlCommand)
the combo box function well. the next thing i do with combox is select 1 or more courses and add into the listbox with the follwoing code
lstTest.Items.Add(cboCourse.SelectedItem) now instead of displaying selected course title it add following text in the list box "system.data.datarowview listbox"
when i change the above code to read something like that:
lstTest.Items.Add(cboCourse.SelectedValue)
it works fine and get course No as selected course value member. I want to retain both selected course Display value as well as value member because whatever list of courses added into the list box will be stored in the database should you require full scope
of this functionality please replay this forum.
Hi, I'm sorry to inform but I've try the method but it doesn't work.
Let me try to repharse my problem
I am developing Windows Form Application, which allows users to upload web applications written in ASP.Net on the ASP.NET website (server). The Form Application running on local machine has following interfaces:
A combox which populated list of all availalbe course from the database stroed on the server
A list box, which the user use a container to select and link 1 or more course with the application they are trying to upload on the server.
A list box is populated with the following code:
Dim CourseTable As New DataSet
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
' connection string hard coded require immediate attention if file path changed from F to something else
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Dim SqlConnection As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=F:\G677Lite_03-04-12\Trading_Floor_11-01-12\App_Data\Trading_Floor.mdf;Integrated Security=True;User Instance=True")
' Dim SqlCommand As New SqlCommand("Select * from Course", SqlConnection)
' for improved secuirty populate course table based on query written in the stored procedure
Dim SqlCommand As New SqlCommand("sproc_Course_GetAll", SqlConnection)
Dim MySqlDataAdapter As New SqlDataAdapter(SqlCommand)
the combo box function well have no problem with it but the next thing i do with the combox is select 1 or more courses and add into the listbox with the follwoing code
now instead of displaying selected course title it add following text in the list box "system.data.datarowview listbox"
when i change the above code to read something like that:
lstTest.Items.Add(cboCourse.SelectedValue)
it works fine and get course No as selected course value member.
what i want is the list box to add and display the course tile selected from the combo box, as well as keeping the information stroed in value member property.
For your information I have Uploaded a screen shot wihich you can view from my drop box link.
Sandeep Tand...
Member
43 Points
67 Posts
system.data.datarowview listbox
Apr 06, 2012 01:00 AM|LINK
I have a combox which populated list of all course from the database with the following code:
Dim CourseTable As New DataSet
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
' connection string hard coded require immediate attention if file path changed from F to something else
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Dim SqlConnection As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=F:\G677Lite_03-04-12\Trading_Floor_11-01-12\App_Data\Trading_Floor.mdf;Integrated Security=True;User Instance=True")
' Dim SqlCommand As New SqlCommand("Select * from Course", SqlConnection)
' for improved secuirty populate course table based on query written in the stored procedure
Dim SqlCommand As New SqlCommand("sproc_Course_GetAll", SqlConnection)
Dim MySqlDataAdapter As New SqlDataAdapter(SqlCommand)
MySqlDataAdapter.Fill(CourseTable)
cboCourse.DataSource = CourseTable.Tables(0)
cboCourse.DisplayMember = "C_Title"
cboCourse.ValueMember = "CourseNo"
the combo box function well. the next thing i do with combox is select 1 or more courses and add into the listbox with the follwoing code
lstTest.Items.Add(cboCourse.SelectedItem) now instead of displaying selected course title it add following text in the list box "system.data.datarowview listbox"
when i change the above code to read something like that:
lstTest.Items.Add(cboCourse.SelectedValue)
it works fine and get course No as selected course value member. I want to retain both selected course Display value as well as value member because whatever list of courses added into the list box will be stored in the database should you require full scope of this functionality please replay this forum.
silvioyf
Participant
1754 Points
340 Posts
Re: system.data.datarowview listbox
Apr 06, 2012 01:29 AM|LINK
I do not know if I understand correctly, but try:
I hope this helps.
Sandeep Tand...
Member
43 Points
67 Posts
Re: system.data.datarowview listbox
Apr 06, 2012 10:03 PM|LINK
Hi, I'm sorry to inform but I've try the method but it doesn't work.
Let me try to repharse my problem
I am developing Windows Form Application, which allows users to upload web applications written in ASP.Net on the ASP.NET website (server). The Form Application running on local machine has following interfaces:
A combox which populated list of all availalbe course from the database stroed on the server
A list box, which the user use a container to select and link 1 or more course with the application they are trying to upload on the server.
A list box is populated with the following code:
Dim CourseTable As New DataSet
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
' connection string hard coded require immediate attention if file path changed from F to something else
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Dim SqlConnection As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=F:\G677Lite_03-04-12\Trading_Floor_11-01-12\App_Data\Trading_Floor.mdf;Integrated Security=True;User Instance=True")
' Dim SqlCommand As New SqlCommand("Select * from Course", SqlConnection)
' for improved secuirty populate course table based on query written in the stored procedure
Dim SqlCommand As New SqlCommand("sproc_Course_GetAll", SqlConnection)
Dim MySqlDataAdapter As New SqlDataAdapter(SqlCommand)
MySqlDataAdapter.Fill(CourseTable)
cboCourse.DataSource = CourseTable.Tables(0)
cboCourse.DisplayMember = "C_Title"
cboCourse.ValueMember = "CourseNo"
the combo box function well have no problem with it but the next thing i do with the combox is select 1 or more courses and add into the listbox with the follwoing code
lstCourse.Items.Add(cboCourse.SelectedItem.ToString)
now instead of displaying selected course title it add following text in the list box "system.data.datarowview listbox"
when i change the above code to read something like that:
lstTest.Items.Add(cboCourse.SelectedValue)
it works fine and get course No as selected course value member.
what i want is the list box to add and display the course tile selected from the combo box, as well as keeping the information stroed in value member property.
For your information I have Uploaded a screen shot wihich you can view from my drop box link.
http://dl.dropbox.com/u/45395435/Populate%20list%20box%20with%20selected%20course.JPG
Thanks in advance