Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi all,

My question is how can be create a Popup window,when we click on a button then popup window is flashed and we enter something in textbox existing in popup and when we click on save the data gets in the textbox of the main window. for example: i want to create a Unit Converter popup which will convert feet into mtrs,cms,inches and after the conversion it show the result in the textbox present on the Main Window.Hope u got what i am trying to say...
Posted
Comments
J.Karthick 26-Jul-11 2:23am    
Create an object for your Popup window like...

Form1 f = new Form1();
f.showDialog();

Will show your Form1...
Hope this helps...

I think we should use popup controls from vb.net and show the popup
 
Share this answer
 
Let's say you called your popup window class "PopupWindow". You created it by right-clicking on your project in project explorer and chosing "Add new Windows Form". Then you added a text box and an "Ok"-Button.

You also added a property to your form so that you can later gain access to the data the user entered in the text box.
public class PopupWindow
{
    public string EnteredText
    {
        get
        {
            return( textBox.Text );
        }
    }
}
Now you use your new class like this:
PopupWindow popup = new PopupWindow();

popup.ShowDialog();

string userEnteredText = popup.EnteredText;

popup.Dispose();
 
Share this answer
 
Comments
Anand Dhamane 26-Mar-13 12:54pm    
Its useful.Thanks
Hi,

Add new form to your solution,eg Abc

on button click,make an object of that form
Abc a= new Abc();
a.ShowDialog();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900