|
Alex Ngai wrote:
2.) Also, I wonder if it is possible to include a link to my e-mail in
the Message Box?
No. You'll have to create your own dialog class that looks like the dialog that MessageBox.Show displays. Otherwise, just put your email address in a LinkLabel in a Form to be used as your About box from the Help menu.
Since you're a newbie and asking pretty basic questions, you should also read the .NET Framework SDK, especially reviewing the class library to see what's available. Many of the properties on the Form class are easily set (as Colin showed you). Being familar with the class library (not necessarily memorizing it) and truly understanding the .NET Framework (like that all compilers for all languages targeting the CLR produce IL so the source language really doesn't matter, which is a common misunderstanding) is important.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I appretiate your help if you tell me how can i build start menue-like in my program using C#....
please respons to me on:
sfayoumy@hotmail.com
or
sfayoumy@yahoo.com
|
|
|
|
|
Put a Button in your application. Create a ContextMenu and when the user clicks your button call ContextMenu.Show passing the Button reference and the position (like the Button.Location property value) to the method. See the ContextMenu.Show method in the .NET Framework SDK documentation for more information and even an example.
But again - like we told you the first time - this is way-overdone and will most likely only confuse users. Read the Windows UI guidelines I linked you.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hi,
how can i set a brush to a hatch style brush in runtime if i know the name of hatchstyle brush(a string) ia sth like "Cross", ???
Help Please!
|
|
|
|
|
string name = "Cross";
HatchStyle style = Enum.Parse(typeof(HatchStyle), name); See Enum.Parse in the .NET Framework SDK documentation for more details.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hi,
i tried that but it won't work and says that:
Cannot implicitly convert type 'object' to 'System.Drawing.Drawing2D.HatchStyle'
There is no SaveGame in real life.
|
|
|
|
|
Sorry, I forgot the cast. The word "implicitly" should've given you a clue to explicitly cast, though.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hey i found that , thats it , just it!!! :::
HatchStyle style = (HatchStyle)Enum.Parse(typeof(HatchStyle),"Some Value");
There is no SaveGame in real life.
|
|
|
|
|
What is beter convention in C#:
1) To keep each class in seperate .CS file
OR
2) Keep all classes of same namespace in a single .CS file
i know both ways work.. but just wanna know what is a better convention
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
One Class - One File (In my opinion)
Having all of one namespace in a single cs file could get very very crowded.
--Colin Mackay--
|
|
|
|
|
In general, what Colin said. Option 1.
Though of course enumeration classes and tightly related classes often stay in one file for me.
regards,
Paul Watson
Bluegrass
South Africa
Brian Welsch wrote:
"blah blah blah, maybe a potato?" while translating my Afrikaans.
Crikey! ain't life grand?
Einstein says...
|
|
|
|
|
Same with me. I also tend to use regions in those cases, too.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
>I also tend to use regions in those cases,
Regions are a god send when you have rafts of ugly collection/enumeration code cluttering up a simple enough class.
regards,
Paul Watson
Bluegrass
South Africa
Brian Welsch wrote:
"blah blah blah, maybe a potato?" while translating my Afrikaans.
Crikey! ain't life grand?
Einstein says...
|
|
|
|
|
True. I especially like them for explicit interface implementations! Sure eliminates a lot of code that probably just calls similarly named methods on the class that implements it.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
numero uno
so everything is easier to remember
|
|
|
|
|
One class per file, and of course real programmers use nested classes, so even then they tend to get big, hopefully .NET 2 will help out there. It would be nice to group files according to function.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
One class per file except when the classes are small, very similar or closely related.
I also put all rarely used classes in the same file.
(Like by aggregation).
God bless regions.
|
|
|
|
|
private void Mousedownhere(object sender, System.Windows.Forms.MouseEventArgs e)
{
DataGrid myGrid = (DataGrid) sender;
System.Windows.Forms.DataGrid.HitTestInfo hti;
hti = myGrid.HitTest(e.X, e.Y);
string message = "You clicked ";
switch (hti.Type)
{
case System.Windows.Forms.DataGrid.HitTestType.None :
message += "the background.";
break;
case System.Windows.Forms.DataGrid.HitTestType.Cell :
message += "cell at row " + hti.Row + ", col " + hti.Column;
message += "Row Number : "+Convert.ToString(myGrid.CurrentRowIndex)+"\n\r"+
myGrid[hti.Row, hti.Column];
fscount = hti.Row;
break;
case System.Windows.Forms.DataGrid.HitTestType.ColumnHeader :
message += "the column header for column " + hti.Column;
break;
case System.Windows.Forms.DataGrid.HitTestType.RowHeader :
message += "the row header for row " + hti.Row;
fscount = hti.Row;
string cellvalue = Convert.ToString(myGrid[hti.Row,2]);
// if (cellvalue==”CHINA”)
MessageBox.Show("value is="+cellvalue,Convert.ToString(hti.Row));
break;
//BUT IF I REMOVE THE COMMENTS FROM THE ABOVE if (cellvalue==”CHINA ”) THEN IT DOES NOT SHOW ME //THE MESSAGEBOX
// WHY???????????????
}
}
|
|
|
|
|
Try debugging your code. Put a break-point at the beginning of that case and step through your code, checking the state of variables as you step over each line. And keep in mind that using the == operator for strings results in a case-sensitive comparison. See String.Compare for a better, culture-aware comparison with many more capabilities.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
String comparison
Is there any way so that all the below conditions give me true results.
String val = “Hello”
Now comparing val it with the following code.
1 “Hello “ //Note white space at the end of Hello.
2 “ Hello” //Note white space at the beginning of Hello.
3 “Hello “ //Note two white spaces left at the end.
4 “ Hello “ //Note white space both at thebegining and end of Hello.
5 “hello” //Note the caps change.
6 “HEllo” //Note the caps change.
Thanks
|
|
|
|
|
Look at the documentation for the String class - not reading won't teach you anything. Specifically, look at the Compare (like I mentioned before which can do case-insensitive and culture-specific comparisons) and Trim methods.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
i'm not a english speaker,i hope you can understand my expression.
i want to compile my code with commands.
i input for example csc example.cs but theres no program result shows.
whether i need any parameter with the "csc" command?
thanks for your help
|
|
|
|
|
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322>csc /?
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
Visual C# .NET Compiler Options
- OUTPUT FILES -
/out:<file> Output file name (default: base name of file with main
class or first file)
/target:exe Build a console executable (default) (Short form:
/t:exe)
/target:winexe Build a Windows executable (Short form: /t:winexe)
/target:library Build a library (Short form: /t:library)
/target:module Build a module that can be added to another assembly
(Short form: /t:module)
/define:<symbol list=""> Define conditional compilation symbol(s) (Short form:
/d)
/doc:<file> XML Documentation file to generate
- INPUT FILES -
/recurse:<wildcard> Include all files in the current directory and
subdirectories according to the wildcard specifications
/reference:<file list=""> Reference metadata from the specified assembly files
(Short form: /r)
/addmodule:<file list=""> Link the specified modules into this assembly
- RESOURCES -
/win32res:<file> Specifies Win32 resource file (.res)
/win32icon:<file> Use this icon for the output
/resource:<resinfo> Embeds the specified resource (Short form: /res)
/linkresource:<resinfo> Links the specified resource to this assembly (Short
form: /linkres)
- CODE GENERATION -
/debug[+|-] Emit debugging information
/debug:{full|pdbonly} Specify debugging type ('full' is default, and enables
attaching a debugger to a running program)
/optimize[+|-] Enable optimizations (Short form: /o)
/incremental[+|-] Enable incremental compilation (Short form: /incr)
- ERRORS AND WARNINGS -
/warnaserror[+|-] Treat warnings as errors
/warn:<n> Set warning level (0-4) (Short form: /w)
/nowarn:<warning list=""> Disable specific warning messages
- LANGUAGE -
/checked[+|-] Generate overflow checks
/unsafe[+|-] Allow 'unsafe' code
- MISCELLANEOUS -
@<file> Read response file for more options
/help Display this usage message (Short form: /?)
/nologo Suppress compiler copyright message
/noconfig Do not auto include CSC.RSP file
- ADVANCED -
/baseaddress: Base address for the library to be built
/bugreport:<file> Create a 'Bug Report' file
/codepage:<n> Specifies the codepage to use when opening source files
/utf8output Output compiler messages in UTF-8 encoding
/main:<type> Specifies the type that contains the entry point (ignore
all other possible entry points) (Short form: /m)
/fullpaths Compiler generates fully qualified paths
/filealign:<n> Specify the alignment used for output file sections
/nostdlib[+|-] Do not reference standard library (mscorlib.dll)
/lib:<file list=""> Specify additional directories to search in for
references
|
|
|
|
|
Hi friend,
I had same problem with my "Hello World" program using CP. I suggest the following:
1. Don't enter the commands in the MS-DOS mode, instead use the Visual Studio .NET Command prompt.
2. Ensure that your program is saved as as .cs "example.cs"
3. In the VS.NET command prompt type csc example.cs
The program will compile successfully if it has no bug. Then type
example (press enter). Your program begins to run.
Enjoy C#
...the mind is not a vessel to be filled but a fire to ignited
|
|
|
|
|
hi extremeg:
thanks for your help
i find the .exe file was create by csc application at the same folder.so,i create a shortcut of visual studio.net command prompt at desktop then i find that the .exe file was on the desktop too. these days i use this method to compile my code and view results i think your method maybe more convenient! thanks for your help... my english is so poor.. i wish that u could understand my message..
|
|
|
|