|
FyreWyrm wrote: Does that sound reasonable?
Yeah, the way I'd do that is, have an enum of forms, store the enum for the form you want in the tag, then write a method that you call which hides all forms, then shows the one specified by the enum value. So, you have one menu click event, which reads the tag, then turns it into an enum and calls one method that is always responsible for setting the visible form.
You can just iterate over the controls collection to hide your controls. You could even have the controls that are the forms have the same tag values so one function checks each controls tag and works out which one to show, no switch or anything needed.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Christian. I appreciate your help. I'm going to look into this more when I get to work tomorrow.
|
|
|
|
|
Cool - just post again if you get stuck.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Actually what you need is a WinForm with one main form and every form will be shown in the main form, one at a time, right?
You can create the forms as per normal, and instead of calling Show(), do the following instead. The form will be shown in the body of main form.
Form2 form = new Form2();
form.FormBorderStyle = FormBorderStyle.None;
form.TopLevel = false;
mainForm.Controls.Add(form);
form.Show();
|
|
|
|
|
Cool - so that basically adds the forms as controls, it's another path to what I was saying ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yep, since it's a form as oppose to control, you can change it to MDI easily.
|
|
|
|
|
|
This seems nasty to me.
I think you need to string mash the table name, I don't think that's what parameters are for.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Here is a snippet:
byte[] b = Encoding.Unicode.GetBytes("?"); // ? is a special (arabic) character,
// but my browser shows it as a ?.
string x = Encoding.Unicode.GetString(b);
While debugging, if I inspect my xx variable, I see a square as character. What did happened and why I did not see exactly the same character that the one I initialized b?
I write the a file, using the several encoding options available. When i read my file, I alway get this @#$%! of square character. But if I paste what I have in x in this message, I get --> "?"
I have a picture of it, but could not attache it
Thanks
modified on Thursday, May 15, 2008 8:33 PM
|
|
|
|
|
Assuming I've understood you right, the rectangle you're seeing is a representation of a character that is either unprintable, or one that isn't available in the font the Inspector is using (the latter reason is probably also why you got a ? instead of the expected character in your browser). It could also be because the inspector is interpreting the encoding wrong. I'd personally think the second cause is most likely.
To be honest, if the code works correctly (and I can see no reason why it won't if your snippet is anything to go by) I'd just ignore this 'feature' of Visual Studio, and use the clipboard and a decent text editor instead.
Hope this helps
Tony
|
|
|
|
|
Hello, I made a program in C# with a webrowser that loads a website. the website unfortunately has flash ads.
is it possible to block flash? or maybe stop the WebBrowser1 from loading <embed> tags? maybe change the embed tag to a div tag so that it doesnt show? how would i go about doing this? any help is appreciated. thanks
if it is too much to ask, i would appreciate some code? i already tried google with no success
modified on Thursday, May 15, 2008 7:46 PM
|
|
|
|
|
How do I get disk volume info in C#? (without having to traverse thru all dirs)
the same info as this function in C++:
GetDiskFreeSpaceEx(str, &lpFreeBytesAvailableToCaller,
&lpTotalNumberOfBytes, &lpTotalNumberOfFreeBytes );
Thanks.
mnnca
mnnca
|
|
|
|
|
You can use DllImport attribute to call GetDiskFreeSpaceEx from your C# code. This is for you to explore: P/Invoke[^]
By the way, DriveInfo Class[^] has quite many information about drives.
Giorgi Dalakishvili
#region signature
my articles
#endregion
modified on Thursday, May 15, 2008 5:43 PM
|
|
|
|
|
Thanks for the help.
I can't get the DllImport to work.
I don't know if it's because of my old IDE (2003).
I've installed up to .net frw 3.5.
System.IO still doesn't have the function "DriveInfo".
When I tried this:
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
the error is:
at "bool"
Expected class, delegate, enum, interface, or struct
why?
Thanks again.
mnnca
mnnca
|
|
|
|
|
DriveInfo class appeared in .Net Framework 2.0 so you need Visual Studio 2005 or later. As for GetDiskFreeSpaceEx pinvoke.net[^] can help you.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Thanks again.
I did try several DllImport code samples from PInvove. They all have the same syntax error.
I think it's my old IDE problem, it cannot open/run most of samples.
I'll need to buy the new .net version (if my boss can get budget for the whole sw group. doubt it!).
regards,
mnnca
mnnca
|
|
|
|
|
You can download Express version of VS2008 and try it there.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
I dont have msdn subscription.
we're still using 6.0 (due to limitation of hardware device drivers, and users' hardware). We bought .net 2003 to learn it only.
mnnca
|
|
|
|
|
Well, theres the System.IO.DriveInfo class which gives a little information on a drive:
DriveInfo di = new DriveInfo(@"C:\");
Console.WriteLine(" Free Space: {0}MB", (di.AvailableFreeSpace/1048576));
Console.WriteLine(" Used Space: {0}MB",(di.TotalSize-di.AvailableFreeSpace)/1048576);
Console.WriteLine("Total Space: {0}MB",di.TotalSize/1048576);
1048576 is 1024*1024 because the properties return the number of bytes.
There's also FileInfo and DirectoryInfo classes, incase you ever want to use those too.
My current favourite word is: Bacon!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Hi,
I concur.
Except, if you mean 1024*1024, then why don't you write it like that, preserving optimal
readability? the compiler will do what is necessary and generate exactly the same code...
|
|
|
|
|
Yeah yeah, think your so clever don't you
Thats just how i wrote it, then i thought i better mention where i pulled the number from. I guess it comes down to "I was to lazy to change the code"
My current favourite word is: Bacon!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
SK Genius wrote: I was to lazy to...
The point is you don't need to first complicate the code and then add comments
to make a reader understand it; instead just keep it simple from the start!
|
|
|
|
|
SK Genius wrote: Yeah yeah, think your so clever don't
No, he knows so
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
Thanks for your help.
I can't get the "DriveInfo" to work.
Please see my reply to Giorgi Dalakishvili.
regards,
mnnca
mnnca
|
|
|
|
|
I am having a form with a textbox and a button..the text box has the value of Zoom In percent..Say for instance 40..When the button is clicked...an image is to be zoomed(for 40%)..How cani do this? Any Clues? or if you have savings of code pl do send..wud b lot helpful.Thanks
|
|
|
|