Click here to Skip to main content
15,888,094 members
Home / Discussions / C#
   

C#

 
AnswerRe: Programming Pin
jaypatel5129-Apr-09 20:15
jaypatel5129-Apr-09 20:15 
AnswerRe: Programming Pin
jaypatel5129-Apr-09 20:38
jaypatel5129-Apr-09 20:38 
AnswerRe: Programming Pin
Skymir10-Apr-09 7:22
Skymir10-Apr-09 7:22 
QuestionSend value from a form to another ! Pin
mrkeivan9-Apr-09 8:22
mrkeivan9-Apr-09 8:22 
AnswerRe: Send value from a form to another ! Pin
DaveyM699-Apr-09 8:39
professionalDaveyM699-Apr-09 8:39 
AnswerRe: Send value from a form to another ! Pin
jaypatel5129-Apr-09 20:39
jaypatel5129-Apr-09 20:39 
GeneralRe: Send value from a form to another ! Pin
mrkeivan10-Apr-09 8:59
mrkeivan10-Apr-09 8:59 
GeneralRe: Send value from a form to another ! Pin
DaveyM6912-Apr-09 21:51
professionalDaveyM6912-Apr-09 21:51 
Like I said before, use an event!
Add a new class IDEventArgs with this code
using System;
public class IDEventArgs : EventArgs
{
    private int _ID;
    public IDEventArgs(int id)
    {
        _ID = id;
    }
    public int ID
    {
        get { return _ID; }
    }
}
Add this to Form2
public event EventHandler<IDEventArgs> GrammarIDSelected;
private void CompleteFormProcessing()
    {
        OnGrammarIDSelected(new IDEventArgs(
            Convert.ToInt32(SelectedRow.Cells["GrammarID"].Value)));
        Close();
    }
    protected virtual void OnGrammarIDSelected(IDEventArgs e)
    {
        EventHandler<IDEventArgs> eh = GrammarIDSelected;
        if (eh != null)
            eh(this, e);
    }
Call CompleteFormProcessing from wherever you need it.
In Form1 add these.
Form2 F2 = new Form2();
F2.GrammarIDSelected += new EventHandler<IDEventArgs>(F2_GrammarIDSelected);
F2.Show();
void F2_GrammarIDSelected(object sender, IDEventArgs e)
{
    // SelectedGrammarID in e.ID
}


Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
Why are you using VB6? Do you hate yourself? (Christian Graus)

QuestionCreate an EXE that runs without .NET Framework Pin
Mogaambo9-Apr-09 7:13
Mogaambo9-Apr-09 7:13 
AnswerRe: Create an EXE that runs without .NET Framework Pin
harold aptroot9-Apr-09 7:21
harold aptroot9-Apr-09 7:21 
AnswerRe: Create an EXE that runs without .NET Framework Pin
Dave Kreskowiak9-Apr-09 7:29
mveDave Kreskowiak9-Apr-09 7:29 
AnswerRe: Create an EXE that runs without .NET Framework Pin
EliottA9-Apr-09 7:38
EliottA9-Apr-09 7:38 
AnswerRe: Create an EXE that runs without .NET Framework Pin
Dan Neely9-Apr-09 7:43
Dan Neely9-Apr-09 7:43 
AnswerRe: Create an EXE that runs without .NET Framework Pin
Christian Graus9-Apr-09 9:26
protectorChristian Graus9-Apr-09 9:26 
GeneralRe: Create an EXE that runs without .NET Framework Pin
Dan Neely9-Apr-09 10:51
Dan Neely9-Apr-09 10:51 
GeneralRe: Create an EXE that runs without .NET Framework Pin
Mogaambo10-Apr-09 4:34
Mogaambo10-Apr-09 4:34 
GeneralRe: Create an EXE that runs without .NET Framework Pin
Henry Minute10-Apr-09 7:49
Henry Minute10-Apr-09 7:49 
GeneralRe: Create an EXE that runs without .NET Framework Pin
Mogaambo12-Apr-09 20:19
Mogaambo12-Apr-09 20:19 
Questioninsert data from EXECL sheet Pin
naveen20_59-Apr-09 6:25
naveen20_59-Apr-09 6:25 
AnswerRe: insert data from Excel sheet Pin
fly9049-Apr-09 6:47
fly9049-Apr-09 6:47 
GeneralRe: insert data from Excel sheet Pin
naveen20_59-Apr-09 6:55
naveen20_59-Apr-09 6:55 
Questionimage processing in c# "(Vector) Pin
Member 36083309-Apr-09 6:04
Member 36083309-Apr-09 6:04 
AnswerRe: image processing in c# "(Vector) Pin
musefan9-Apr-09 6:28
musefan9-Apr-09 6:28 
QuestionSystem.Threading.ThreadStateException was unhandled Pin
Alan Balkany9-Apr-09 5:58
Alan Balkany9-Apr-09 5:58 
AnswerRe: System.Threading.ThreadStateException was unhandled Pin
S. Senthil Kumar9-Apr-09 6:51
S. Senthil Kumar9-Apr-09 6:51 

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.