473,395 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

windows form listbox.selectedvale

hi ,

The below is my code. One the first form i would like to get the selected value the user chose, and pass this info to the second form for editing of thru the primary key ID.

But i can't seem to pass the selectedvale over. anybody can help see what's wrong?


Expand|Select|Wrap|Line Numbers
  1.  public void viewAllLocation_Load(object sender, EventArgs e)
  2.         {
  3.   listBox2.DataSource = type.getLocation();
  4.             listBox2.DisplayMember = "LocationName";
  5.             listBox2.ValueMember = "LocationID";
  6.  }
  7.  
  8.  public void button3_Click(object sender, EventArgs e)
  9.         {
  10.  
  11. updateLocation frm = new updateLocation(listBox2.SelectedItem.ToString());
  12.             frm.Show();
  13.  

Expand|Select|Wrap|Line Numbers
  1.  
  2. using System;
  3. using System.Windows.Forms;
  4.  
  5. namespace ListBoxMenuSample
  6. {
  7.     public partial class updateLocation : Form
  8.     {
  9.  
  10.         public updateLocation()
  11.         {
  12.             InitializeComponent();
  13.         }
  14.  
  15.  
  16.  
  17.         public string _textBox
  18.         {
  19.             set { textBox1.Text = value; }
  20.         }
  21.  
  22.         public updateLocation(string strTextBox)
  23. {
  24.   InitializeComponent();
  25.   textBox1.Text = strTextBox;
  26. }
  27.  
  28.  
  29.     }
  30. }
  31.  
  32.  
  33.  
Oct 21 '10 #1
0 972

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: dl | last post by:
Windows Forms listbox have a SelectedValue property that is used to retrieve the value associated with the currently selected item. How do I retrieve the value associated with any specified item,...
1
by: Wade Beasley | last post by:
I have developed a Windows Forms application with C#. On the windows form I have a master list box with the names of people the user can select from and when selected it calls a Select in SQL...
4
by: kackson | last post by:
Hi. I attempted to create a multicolumn listbox for my web based aspx application. I search the net, all I get is something like listview or I need to have system.windwos.form. But for the...
3
by: Bill Kinnersley | last post by:
I have a Windows Form with a very large ListView, about 10,000 items. There is a very significant delay each time the form is opened (ShowDialog) or closed (Hide). The ListView has not been...
9
by: Justin Engelman | last post by:
Hi, I have a website that uses an ISAPI filter that will redirect anyone going to any page on the site to an SSL login page (on a different website with the same root domain) if they do not have...
2
by: ano | last post by:
Hi all, I'm a C# newbie. My application contains several projects. One of project is Windows Form application. Others are a class library. My question is how to parsing messages from project A...
1
by: Frank | last post by:
Hi, Is it possible to code a Windows Form application (v.1.1) to create an HTML file in the Forms project folder, embedd variable values in hidden fields, and have the HTML page redirect to...
2
by: keshri | last post by:
Hi Friends, This is keshri here. I am pursuing MCA in final year and together I am getting training of Asp.Net and Windows Applications Forms with C#. My question is : I want to create a windows...
4
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= | last post by:
Hi, I have just started building an application which is windows form based, rather than web based, and I am having troubles with layout. I can't find any control which gives me just a simple text...
2
by: deccio | last post by:
I have create an activex Control with Visual studio 2005 and framework 2.0 in c# to add drag & drop functionality to upload multi file. When I use it in a windows form it work fine. Infact if I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.