Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a main form, and call ShowDialog method (form2). After 2', application will logout and show form login. I want to close all form showing.
Application.OpenForm will be useful
foreach (Form f in Application.OpenForms)
{
if(f.Name != "MainFormName")
{
// don't close main form
f.Close();
}
}
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Needs details or clarity Add details and clarify the problem by editing this post.
Improve this question
Opening an existing PDF in window form in C#
You can do it using custom event create event on form1 and hit event in form2
in form1 globe event
public event EventHandler OpenPDF;
add this code into form1 help button click event
if (OpenPDF!= null)
{
this.OpenPDF(this, null);
}
and in form 2 initialize this event in constructor
var frm1= new form1();
frm1.OpenPDF+=delegate{
axAcroPDF1.src = "File_name.pdf";
};
i think this is work
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
So I'm trying to make something and I know how to make topmost but how do I make it where from another tab like a settings tab make the main topmost but the check box is in a different tab then the one I want topmost?
here is the code I use for just being on the same tab.
if (!TopMost)
{
TopMost = true;
}
else
{
TopMost = false;
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I just need to execute some code. But I don't need to put it in any event handler.
Is there any posibility to do that in C# language? In particular, in Windows Form.
In other words how to execute a code beyond any event handlers like "button click", "mouse click", "timer tick" and so forth.
if (!boolA)
{
//do here something
}
else return;
You can put it in the constructor of the form or double click your form and put the code in the Load handler (although this is an event handler but it is very customary to put code here that needs to be executed before the form is shown). You can also put the code in the class named Program.cs and that code will be executed when the application starts-just put the code before you show the entry form.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I try this but didn't work for me
private void listBoxControl2_SelectedValueChanged(object sender, EventArgs e)
{
listBoxControl5.SelectedIndex = listBoxControl2.SelectedIndex;
}
the question is sync movement of the selector on both listboxs for example if listbox1 was selected item 2 the other listbox should be on item 2 and if i move scroll on one of them the other should act same
Try doing it like this:
var itemIndex = listBoxControl2.SelectedIndex;
ListBoxControl5.SelectedItem =
ListBoxControl2.Items.IndexOf(itemIndex);
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have three windows forms like below images. I want to combine all three forms into one form. Which I can show fullscreen application as a one window
I can't use only one form with all the code. It has to be something like this three forms combined into one full-screen form. Is there a way to combine them?
You can do this by MDI Container
FormA formA = new FormA();
formA.IsMDIContainer = true;
FormB formB = new FormB();
formB.MDIParent = formA;
formB.Show();
FormC formC = new FormC();
formC.MDIParent = formA;
formC.Show();
and then run
formA.Show();
look at this article