Avatar of Sha1395
Sha1395
 asked on

pop up window in winforms

Okie finally i have a code for my hyperlink column in my datagridview

  void ErrGrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
               
            // Ignore clicks that are not on button cells. 
            if (e.RowIndex < 0 || e.ColumnIndex != ErrGrid.Columns["MessageId"].Index) return;
                            
            //// Retrieve the Row Index
            string RowId = ErrGrid[0, e.RowIndex].Value.ToString();
            //// convert string to Interger
             int RowIndex;
             int.TryParse(RowId, out RowIndex);
            //Retrive the Error Queue Message for that particular Row Index
             string MesId = ErrGrid.Rows[RowIndex].Cells["Queue"].Value.ToString();
             MessageBox.Show(MesId);
           
        }  

Open in new window

I need small help here,rather than using messagebox here is this anyway i can open new window (pop up) to display the message
showdialog().
C#

Avatar of undefined
Last Comment
Sha1395

8/22/2022 - Mon
Minh Võ Công

Yes, you can

Replace the line  MessageBox.Show(MesId); by:

YourForm form = new YourForm(...);
form.ShowDialog();
Sha1395

ASKER
i changed my code based on your input

frmDataGridPaging form = new frmDataGridPaging();
             form.ShowDialog(MesId);

but its throwing exception here " form.ShowDialog(MesId);" invalid arguments

ASKER CERTIFIED SOLUTION
mrjoltcola

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
mrjoltcola

>>but its throwing exception here " form.ShowDialog(MesId);" invalid arguments

ShowDialog() does not take any arguments.

Approach it like my sample to make your own, it'll be simpler in the long run.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Sha1395

ASKER
thanks mrjoltcola.

Even i have to format my message once it populated,am populating XML messages.
Sha1395

ASKER
Hi Minhvc,


frmDataGridPaging form = new frmDataGridPaging();
form.ShowDialog(this);

its opening a new form with out any message.i want to populated the "MesId" in the pop up window. MessageBox.show works fine but i have to format and present it in a nicer way