|
Name Description
ShowDialog()()() Shows the form as a modal dialog box with the currently active window set as its owner.
ShowDialog(IWin32Window) Shows the form as a modal dialog box with the specified owner.
From the MSDN website.
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.showdialog.aspx
|
|
|
|
|
|
Hey, glad to help you man
Yeah, I guess I got my answer mixed up though.
|
|
|
|
|
i created an application using Visual C# connecting to Linux server and using MySQL as its database. here's my test application.. (guide link)
http://camilord.kagayan.com/2009/04/13/visual-c-connecting-to-mysql-remotely/
but my problem is how can I resolve the lag connection to remote server? because every time I connect to the server, it took few seconds to respond. kinda laggy. any ideas to solve this problem?
|
|
|
|
|
I wanted to close a previous form after calling the next form. How do i do that?
I have many form in my application. When i exit the application using the following code all the forms are closed one by one. Instead i want to close the previous form after calling the next form in order to avoid the closing of all the forms after exit. Please help.
DialogResult result = MessageBox.Show("Do you want to exit?", "Exit-Window", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
if (result == DialogResult.OK)
Application.Exit();
I have tried with the following code but the application exits automatically.
The code is written on the command button on Form1.
private void button1_Click(object sender, EventArgs e)
{
Form2 frm2 = new Form2();
frm2.Show();
this.Close();
}
|
|
|
|
|
The reason why the application exits automatically is that the entry point for it is located in a class usually called Program.cs that has the following code:
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
The last line (Application.Run(new Form1())), starts a message loop that ends as soon as the main form is closed (new Form1()), what causes the end of the application.
To prevent the application from exiting I've found two possible solutions based on your original idea:
1. The first one is not to close the main form but to hide it:
private void button1_Click(object sender, EventArgs e)
{
Form2 frm2 = new Form2();
frm2.Show();
this.Hide();
}
2. The second is to invoke the Application.Run() overload that doesn't take a Form as parameter but an ApplicationContext. This object (that always exist), implements an overridable method called OnMainFormClosed() that is responsible of shutting down the application when the main form is closed. To prevent this from happening, you can derive a new class from it that substitutes the original method by another that does nothing:
//New class.
class ApplicationContextOwn : ApplicationContext {
//Overriden method does nothing
protected override void OnMainFormClosed(object sender, EventArgs e) {
}
}
static class Program {
public static ApplicationContext ac = new ApplicationContext();
///
/// The main entry point for the application.
///
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//The application is started using an instance of the new class.
ApplicationContext ac = new ApplicationContextNew();
ac.MainForm = new Form1();
Application.Run(ac);
}
}
Hope this helps.
|
|
|
|
|
The application is closing because you're calling the main form that was started by the application.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
hi all
This is to read the tag line by line.
using System.Xml;
...
...
...
XmlTextReader reader = new XmlTextReader ("reader.xml");
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element: // The node is an element.
Console.Write("<" + reader.Name);
Console.WriteLine(">");
break;
case XmlNodeType.Text: //Display the text in each element.
Console.WriteLine (reader.Value);
break;
case XmlNodeType.EndElement: //Display the end of the element.
Console.Write("</" + reader.Name);
Console.WriteLine(">");
break;
}
}
Console.ReadLine();
How do i read the specific tag
if i just want to read all the tag that have this < big > tag?
thank you
modified on Monday, April 13, 2009 3:36 AM
|
|
|
|
|
use an XmlDocument[^] and the SelectNodes[^] method to search for specific nodes. This[^] article has a nice cheat sheet of the XPath syntax for searching for nodes.
|
|
|
|
|
I am developing an application in which I need to compare two pieces of VB code. I am searching a component which I can embed and do? Can any one help in this regard? Or any codes foe developing such a tool.
Regards
Surya
|
|
|
|
|
Hi,
I programatically have to create a windows application in which one windows schedular is there which is for calling a webmethod in a webservice...
how to create such program to call webmethod using windows schedular in C#.net.
Pls help me in this...
Advanced Thanks,
Ravi Vellanki
|
|
|
|
|
There is nothing special about Windows scheduler. You call the web methods as you usually would, in a regular app, then schedule your app to run using Windows scheduler.
If you don't know to create or consume web methods, use Google or buy a book.
|
|
|
|
|
Dear All,
I am trying to display this help file on button click event,
Microsoft® HTML Help Executable
and i want to edit and save it.
Please guide me how i can do this i am also searching for this.
Thanks
Sajjad Ali
|
|
|
|
|
In Help button event to show the help file.
u can use the methos " System.Diagnostics.Process.Start("yourHelpFile")"
in web format.
usually, the help is not needed to be edited, when show to the user.
|
|
|
|
|
I done it it is working now,
But i want to edit and save .chm file.
and again want to display it in application.
What should i do for this i have down loaded editor for .chm file but now i am getting where i have to start it.
Please do replay.
Sajjad
|
|
|
|
|
I have a dataset,and have defined a table in it,and now,I want to copy another table's data to this dataset's table.How to do this?
Thank you.
Always do you best,what you plant you will harvest
later!
|
|
|
|
|
This question has been done.Use DataSet's Merge method can do this.thank you.
Always do you best,what you plant you will harvest
later!
|
|
|
|
|
Hi,
I am trying to enable the keypress event for 'F5' key to refresh my form... Because I found that the normal KeyPress event does not work for function keys, I tried overriding the PreProcessMessage() function, as follows :
public override bool PreProcessMessage(ref Message msg)
{
try
{
if (msg.Msg == WM_KEYDOWN)
{
Keys keyCode = (Keys)msg.WParam & Keys.KeyCode;
if (keyCode == Keys.F5)
{
//code
}
}
return PreProcessMessage(ref msg);
}
catch (Exception ex)
{
throw;
}
}
But the control never gets into this method... Can anyone help me fix this?
Thanks in advance,
ramzg
|
|
|
|
|
You should change the keypreview property to true of form. if it is set to false.
|
|
|
|
|
Hi S a n d y,
I tried what had posted... But still, the control doesnt get inside the method... Do i have to do something else?
Thanks,
ramzg
|
|
|
|
|
You use the wrong syntax!, the correct syntax is
protected override bool ProcessCmdKey(
ref Message m,
Keys keyData
)
Try this:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.F5)
{
MessageBox.Show("F5 pressed!");
}
return base.ProcessCmdKey(ref msg, keyData);
}
Hope this help.
*12Code
|
|
|
|
|
Hi 12Code,
Thanks a lot for the help... It is working now...
Thanks,
ramzg
|
|
|
|
|
Hi,
How can i convert C++ to C# or any other VS languages?
Thankyou
YPKI
|
|
|
|
|
ypki wrote: How can i convert C++ to C# or any other VS languages?
By reading and understanding what the C++ application is doing then re-writing it in C#.
If it is managed C++ then you might be able to run the assemblies through Red Gate's Reflector to see what they produce as it could be a viable shortcut.
|
|
|
|
|
The C plus plus is similar with the C sharp. If this project is not too big, you can create a C sharp project, and then add these C++ files to this project, and comment codes in these files, and then modify format from c++ to C# format one class by one class.
|
|
|
|