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?
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?
Code:
public void viewAllLocation_Load(object sender, EventArgs e)
{
listBox2.DataSource = type.getLocation();
listBox2.DisplayMember = "LocationName";
listBox2.ValueMember = "LocationID";
}
public void button3_Click(object sender, EventArgs e)
{
updateLocation frm = new updateLocation(listBox2.SelectedItem.ToString());
frm.Show();
}
Code:
using System;
using System.Windows.Forms;
namespace ListBoxMenuSample
{
public partial class updateLocation : Form
{
public updateLocation()
{
InitializeComponent();
}
public string _textBox
{
set { textBox1.Text = value; }
}
public updateLocation(string strTextBox)
{
InitializeComponent();
textBox1.Text = strTextBox;
}
}
}