Click here to Skip to main content
15,898,374 members
Home / Discussions / C#
   

C#

 
QuestionHow do I find the field in which the match has been found? Pin
Shubhanshu Pathak22-May-14 8:12
Shubhanshu Pathak22-May-14 8:12 
AnswerRe: How do I find the field in which the match has been found? Pin
OriginalGriff22-May-14 8:27
mveOriginalGriff22-May-14 8:27 
AnswerRe: How do I find the field in which the match has been found? Pin
Shubhanshu Pathak22-May-14 18:19
Shubhanshu Pathak22-May-14 18:19 
GeneralRe: How do I find the field in which the match has been found? Pin
Richard MacCutchan22-May-14 21:04
mveRichard MacCutchan22-May-14 21:04 
QuestionHow to read data from Staff ID Card using c# Pin
Member 1050484922-May-14 3:46
Member 1050484922-May-14 3:46 
AnswerRe: How to read data from Staff ID Card using c# Pin
Richard MacCutchan22-May-14 3:54
mveRichard MacCutchan22-May-14 3:54 
QuestionShare an event between two forms. Pin
jenya722-May-14 2:18
jenya722-May-14 2:18 
AnswerRe: Share an event between two forms. Pin
joost.versteegen22-May-14 3:36
joost.versteegen22-May-14 3:36 
C#
public partial class Form1 : Form
{
  public delegate void ListBoxItemClickHandler(string itemText);

  private ListBoxItemClickHandler OnListBoxItemClick;

  public Form1()
  {
    InitializeComponent();
  }

  private void Form1_Load(object sender, EventArgs e)
  {
    listBox1.Items.Add("monkey");
    listBox1.Items.Add("nut");
    listBox1.Items.Add("car");

    Form2 frm = new Form2();
    OnListBoxItemClick += new ListBoxItemClickHandler(frm.ShowItem);
    frm.Show();
  }

  private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
  {
    if (OnListBoxItemClick != null) OnListBoxItemClick(listBox1.SelectedItem.ToString());
  }
}

public partial class Form2 : Form
{
  public Form2()
  {
    InitializeComponent();
  }

  public void ShowItem(string itemText)
  {
    textBox1.Text = itemText;
  }
}

GeneralRe: Share an event between two forms. Pin
jenya722-May-14 4:12
jenya722-May-14 4:12 
GeneralRe: Share an event between two forms. Pin
jenya722-May-14 4:15
jenya722-May-14 4:15 
GeneralRe: Share an event between two forms. Pin
jenya722-May-14 4:53
jenya722-May-14 4:53 
AnswerRe: Share an event between two forms. Pin
joost.versteegen22-May-14 4:40
joost.versteegen22-May-14 4:40 
GeneralRe: Share an event between two forms. Pin
jenya722-May-14 4:56
jenya722-May-14 4:56 
AnswerRe: Share an event between two forms. Pin
BobJanova22-May-14 5:02
BobJanova22-May-14 5:02 
GeneralRe: Share an event between two forms. Pin
jenya722-May-14 5:07
jenya722-May-14 5:07 
GeneralRe: Share an event between two forms. Pin
BobJanova22-May-14 5:47
BobJanova22-May-14 5:47 
GeneralRe: Share an event between two forms. Pin
jenya722-May-14 7:28
jenya722-May-14 7:28 
Questionc# Pin
Member 1083669622-May-14 1:18
Member 1083669622-May-14 1:18 
AnswerRe: c# Pin
Rob Philpott22-May-14 1:25
Rob Philpott22-May-14 1:25 
GeneralRe: c# Pin
Richard MacCutchan22-May-14 2:01
mveRichard MacCutchan22-May-14 2:01 
AnswerRe: c# Pin
Richard MacCutchan22-May-14 2:02
mveRichard MacCutchan22-May-14 2:02 
AnswerRe: c# Pin
Chris Quinn22-May-14 2:16
Chris Quinn22-May-14 2:16 
AnswerRe: c# Pin
ZurdoDev22-May-14 4:59
professionalZurdoDev22-May-14 4:59 
GeneralRe: c# Pin
Chris Quinn22-May-14 5:02
Chris Quinn22-May-14 5:02 
GeneralRe: c# Pin
ZurdoDev22-May-14 5:06
professionalZurdoDev22-May-14 5:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.