Click here to Skip to main content
15,894,410 members
Home / Discussions / C#
   

C#

 
AnswerRe: Retrieve form variable name Pin
Luc Pattyn7-Oct-09 11:49
sitebuilderLuc Pattyn7-Oct-09 11:49 
GeneralRe: Retrieve form variable name Pin
genisyssoftware7-Oct-09 12:00
genisyssoftware7-Oct-09 12:00 
GeneralRe: Retrieve form variable name Pin
Luc Pattyn7-Oct-09 12:31
sitebuilderLuc Pattyn7-Oct-09 12:31 
GeneralRe: Retrieve form variable name Pin
genisyssoftware8-Oct-09 3:47
genisyssoftware8-Oct-09 3:47 
GeneralRe: Retrieve form variable name Pin
Luc Pattyn8-Oct-09 4:42
sitebuilderLuc Pattyn8-Oct-09 4:42 
GeneralRe: Retrieve form variable name Pin
genisyssoftware9-Oct-09 3:59
genisyssoftware9-Oct-09 3:59 
GeneralRe: Retrieve form variable name Pin
Luc Pattyn9-Oct-09 4:22
sitebuilderLuc Pattyn9-Oct-09 4:22 
GeneralRe: Retrieve form variable name Pin
genisyssoftware19-Oct-09 9:59
genisyssoftware19-Oct-09 9:59 
Luc - making progress here, but I'm a bit baffled by what is wrong here in this code:

public static void CloseAllForms()
{
MessageBox.Show("Number of open forms: " + Application.OpenForms.Count);

string tag;
int i=0;

foreach (Form frm in Application.OpenForms)
{
// frm.Dispose();
i = i + 1;
tag = frm.Tag.ToString();
MessageBox.Show("in loop, i="+i+" tag = "+tag);
}
}

What I'm trying to do is go through all the open forms that have a tag value populated, as those would be forms that I opened (The intial count that I display here seems to show more forms than I have opened, but I'll get to the bottom of this once I can figure out the simple things). In this code above, I'd sure think I'd be able to set the tag value to a string, and then display that in this loop. This code compiles, but when I execute it, I only get the initial count displaying, and I get one blank dialog box displaying. If I remove the "tag = frm...." line, the loop displays 4 or 5 times). So there's something I don't yet understand about how to access form names, or forms themselves. I think there's some issues with trying to set the "tag" variable above if the .Tag property has not yet been set on a form, and maybe that's my problem. But if you were to replace my code above with trying to loop through and display the .Tag property of forms, how would you do this? (Keeping in mind that not all open forms may have a tag value set).
GeneralRe: Retrieve form variable name Pin
Luc Pattyn19-Oct-09 10:08
sitebuilderLuc Pattyn19-Oct-09 10:08 
GeneralRe: Retrieve form variable name Pin
genisyssoftware19-Oct-09 12:19
genisyssoftware19-Oct-09 12:19 
GeneralRe: Retrieve form variable name Pin
Luc Pattyn19-Oct-09 12:33
sitebuilderLuc Pattyn19-Oct-09 12:33 
QuestionChecking Connection C# Pin
eawedat7-Oct-09 11:22
eawedat7-Oct-09 11:22 
AnswerRe: Checking Connection C# Pin
Luc Pattyn7-Oct-09 11:54
sitebuilderLuc Pattyn7-Oct-09 11:54 
QuestionSAConnection String Pin
MWRivera7-Oct-09 10:54
MWRivera7-Oct-09 10:54 
AnswerRe: SAConnection String Pin
Henry Minute7-Oct-09 11:02
Henry Minute7-Oct-09 11:02 
GeneralRe: SAConnection String Pin
MWRivera8-Oct-09 3:39
MWRivera8-Oct-09 3:39 
GeneralRe: SAConnection String Pin
Henry Minute8-Oct-09 3:47
Henry Minute8-Oct-09 3:47 
GeneralRe: SAConnection String Pin
MWRivera8-Oct-09 5:02
MWRivera8-Oct-09 5:02 
GeneralRe: SAConnection String Pin
Henry Minute8-Oct-09 5:28
Henry Minute8-Oct-09 5:28 
Questionautocad c# and robot Pin
kalidG7-Oct-09 9:32
kalidG7-Oct-09 9:32 
AnswerRe: autocad c# and robot Pin
Christian Graus7-Oct-09 9:59
protectorChristian Graus7-Oct-09 9:59 
QuestionProblem with using "out" in void methods Pin
AndyASPVB7-Oct-09 8:58
AndyASPVB7-Oct-09 8:58 
AnswerRe: Problem with using "out" in void methods Pin
Luc Pattyn7-Oct-09 9:08
sitebuilderLuc Pattyn7-Oct-09 9:08 
AnswerRe: Problem with using "out" in void methods Pin
Mirko19807-Oct-09 10:09
Mirko19807-Oct-09 10:09 
GeneralRe: Problem with using "out" in void methods Pin
AndyASPVB7-Oct-09 12:00
AndyASPVB7-Oct-09 12:00 

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.