|
Does anyone have a code sample that they could send me showing how to go from a main menu program to several different windows? I can build each individually, but can't figure out how to bring them all together.
Thanks in advance
Daniel Stagg
dstagg@universalsolutions.com
|
|
|
|
|
Do you mean that you want to create an MDI (Multiple Document Interface) app or just a program which presents different windows (forms) for options, etc?
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
On a MenuItem just set MdiList to true . That MenuItem will become a popup and it's children will automatically display all the MDI child windows.
If you want a menu to simply show a new dialog (like an owned form), then do something like this:
MyForm form = new MyForm();
this.AddOwnedForm(form);
form.Show(); Each menu would probably either open a new form. If you want to communicate with an existing form, then declare a variable in your class. When a menu is clicked, check that the variable isn't null and then call methods or get/set properties or fields.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
this isn't a question....but....
i've just ordered and am waiting for the Wrox Press Professional C# Third Edition to come out on the 16th ,- anybody else got or getting this or something like it? i've always quite liked books by wrox: normally clear, with good examples, ideas, and covering a wide range of stuff in depth.
any suggestions for any future books on C# by any of you lot? any you've read and would recommend? i'm mainly interested in forms, gdi+, controls &etc. not so much in databases but all comments welcome...
-------------------------------------------------------
ithium is the best.
'Science without religion is lame, religion without science is blind.' --Albert Einstein
'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein
|
|
|
|
|
|
It's my favorite place to find everything I need!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Why print it out? It's online and possible to search. If you want an offline copy, get the MSDN Library subscription, a mere $199 for the first year and only $99/year after that.
MSDN is a comprehensive reference - books are not (unless you get those that are a compendium). If you can't understand the APIs, frameworks, or concepts from the reference, then you probably do need someone else (i.e., a book author) to explain it to you.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
I saw the cinicism in it, but it seemed like you were saying that MSDN is not a good reference because it's so big. Believe it or not, many people have said that...
"Oh, I haven't looked because there's too much stuff."
Sorry.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
thankyou all for your helpful comments! :P
will check out what you have said...
-------------------------------------------------------
ithium is the best.
'Science without religion is lame, religion without science is blind.' --Albert Einstein
'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein
|
|
|
|
|
Check out Windows Forms Programming in C# by Chris Sells.
Kuphryn
|
|
|
|
|
thankyou. looks quite cool...
-------------------------------------------------------
ithium is the best.
'Science without religion is lame, religion without science is blind.' --Albert Einstein
'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein
|
|
|
|
|
microsoft press has copule really good ones.
probably the best book about windows forms and graphcis (GDI+)
Programming Microsoft Windows with C# by Charles Petzold
pretty thick with about 1200 pages. You can use it as a reference and to just read about things.
http://www.amazon.com/exec/obidos/tg/detail/-/0735613702/qid=1086702102/sr=1-4/ref=sr_1_4/104-9011139-0631159?v=glance&s=books
and a really good bood about .net framework:
Applied Microsoft .NET Framework Programming by Jeffrey Richter
http://www.amazon.com/exec/obidos/tg/detail/-/0735614229/qid=1086701997/sr=1-1/ref=sr_1_1/104-9011139-0631159?v=glance&s=books
|
|
|
|
|
thankyou, will check out.
-------------------------------------------------------
ithium is the best.
'Science without religion is lame, religion without science is blind.' --Albert Einstein
'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein
|
|
|
|
|
Hi guys. I may have a stupid question. I'm a bit of a newbie to C#. So, to get into things I'm building a CD player. Now, I know there's a tutorial here. But before I dive into the MCI, I had a question about the WMP.dll. Would it be easier and simpler to use that? Can I use that? How do I use that? For example, in the tutorials home made .dll he has to use the MCI to eject the CD rom.
In the wmp there's a method for doing so called "player.cdromCollection.item(index).eject()". Now, how would I clal that method. And from my understanding, I have to in a sense 'install' the player into my app. I just want a button that says "eject" and calls this method. Just to experiemtn with, not the whole media player with media window and play and stop buttons. Is this possible? For example, can I use Environment to find the CD Drive and it's path and then from there eject the cd? Or better yet create a CD Rom Object and use driveSpecifier?
Again I'm new to this, so help me out if you can. It would be just easier for a newbie lke myself to use these commands already in wmp.dll by importing that library then necessarily messing with the MCI.
Thanks for reading and hopefully answering.
|
|
|
|
|
Yes, it's possible, but then you're not really writing a CD-ROM player, are you? Besides, if you're new, you should really start out with something a little more basic.
To include the Windows Media Player into your Windows Forms application, customize your toolbox in VS.NET. Click the COM tab and find the Windows Media Player control and add it to your toolbox. Then simply drag and drop that onto a container control (like a Form or UserControl ) and two interop assemblies (a.k.a. Runtime Callable Wrappers) are created - one for the ActiveX control, and one for the WMP typelib. Then add your Eject button, for example, and call the method on your player control, which is declared as a variable.
To note, if you're going to strongly name your assembly (and it's always a good idea to, especially if you need to install it into the Global Assembly Cache (GAC) or do anything decent with versioning assemblies) you should right-click on your project and select Properties. Find the assembly key filename and pass the filename (path relative to the project, or an absolute path) of a key pair you generated with sn.exe -k KeyFile.snk (any filename will do). When the interop assemblies are created, they are created with strong names as well. A strong name assembly can only reference other strong named assemblies, though non-strongly named assemblies can reference strongly named assemblies.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have see the EnsureVisible Method of both TreeView, and TreeViewItem. I want to just check if the item is visible or not, I don't neccessarily want to force it to be visible. I've also see TopItem, but I'd reather be able to check the visibility of any item in the control. I imagine I could use GetItemBounds to get the height of each Item then do some math to see if the control's height is large enough to show the specific Item in question, but I didn't know if there was a built in Property or function that would be better to use ?
Thanks for any thoughts you may have.
|
|
|
|
|
You didn't see TreeNode.IsVisible when looking at all those properties?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Wow,big Typo there I meant to say ListView not TreeView...sorry about that.
|
|
|
|
|
Then either use ListView.GetItemRect or ListViewItem.Bounds (or ListViewItem.GetBounds , but used in the same way) and determine if the returned Rectangle.Y is greater than the ListView.Bottom .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
OK, I kinda figured those would be my options, thanks Heath....
|
|
|
|
|
I need to upload from exel doc every day 20 rows of 5 input fields into my company's web site to an aspx page into asp:textbox components and send to server via send butoon in a loop(20 times). anyone please point me to code for doing that anyway in c#.
10x
|
|
|
|
|
Simple: write an application that uses a timer, read-ins the Excel spreadsheet using an interop library (add a reference to Microsoft Excel to your project), and POST the data (see the HttpWebRequest and HttpWebResponse classes) to your ASP.NET application.
If you want help with something specific, then ask about something specific. This forum is intended to help you with programming question, not really to help you design an application.
Microsoft MVP, Visual C#
My Articles
|
|
|
|