|
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..
|
|
|
|
|
any equivalent of MAP files in C# for debugging??
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
Not exactly like a MAP file - but serves much of the same purpose - the PDB file that is generated in a debug build contains the symbols for a debug version of an executable. While the IL for a debug assembly is pretty much the same as it is for a release assembly (barring a differences, like when you use pre-proc conditions or attribute a method with the ConditionalAttribute ), the debug build contains the path to a PDB file in another file segment. These are useful in debugging and will provide method lookups, line numbers, filenames, etc.
These won't work for release builds, 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-----
|
|
|
|
|
Hi
I need some help in getting a video played in the back ground of my win form where I will add some controls that would display some text and other stuff.
What I did until know is.
Using interop and Com I am able to play the video inside a panel, but here is the problem if I add a control inside the panel ex.
This.controls.add(panel1)
This.panel1.Controls.Add(textcontrol)
When the video loads it is hiding everything in the same control (panel1) but not all the form unless I set the size of panel1 to be as the same size as the form.(I don’t want every thing to be hidden I want the controls to show over the video with an alpha transparency level )
What I did is instead of adding the textcontrol to the panel1 I am adding it to the main form so I am being able to put the text over the video, but I am losing the benefit of having an alpha (transparency) for my text.
I would weolcme any suggestion to solve this and any alternative solution
Simply what I am trying to achieve now is to have a news bar like the one that you can see on CNN by adding text over the video
Thanks for reading this.
Best regards
|
|
|
|
|
Most video players like Windows Media Player (which I assume you're using) show the video in a separate layer that doesn't allow them to be hosted like that, otherwise someone could easily capture the video which may or may not be protected. You can further see proof of this by trying to take a screenshot - you shouldn't see any video.
You should take a look at DirectX: http://msdn.microsoft.com/directx[^]. There's a lot more you have to do, but there are a few examples here on the CP site that should help.
-----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-----
|
|
|
|
|
Hallo...
Does anyone know how to read/write/format floppy or hd sectors, tracks, heads, ecc.....
I used to use INT 13h with veeeeery old DOS and old C, but now with WindowsXP and C#???????
Thank you...
|
|
|
|
|
C# - rather, the .NET base class library (BCL) - does not provide such features. This is much too low-level for the BCL. You'll have to P/Invoke native functions (see DllImportAttribute documentation for details). You should also try searching this site or googling the rest of the 'net for any examples.
-----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-----
|
|
|
|
|
foreach(string message in mail.LIST())
Console.WriteLine("S: "+message);
How can I get this to 1 line?
/\ |_ E X E GG
|
|
|
|
|
in C++ you could do something like
for (int i = 0;i < mail.count(); i++, Console.WriteLine(mail.item(i)));
I dunno if C# supports the comma within a for loop.
You can also do this:
foreach(string message in mail.LIST()) Console.WriteLine("S: "+message);
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I guess I should mention that, LIST is an ArrayList.
/\ |_ E X E GG
|
|
|
|
|
I thought it might be, but I was setting out to show the general syntax where a for loop would do what you want, not to write the specific code for you. Writing a for loop that actually does what you want should be a no brainer if the comma notation is supported.
BTW, I should mention that while I'll also often see how terse I can make my code, number of lines is not always an indicator of anything. Always consider before you make 6 lines of code into 2 if your code has become easier, or harder to read and maintain. Also, the shorter code does not necessarily run any faster, and may be slower.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
excellent.
/\ |_ E X E GG
|
|
|
|
|
And obfuscating your code like that doesn't compile any differently. There is no difference between
foreach (...) doSomething(); OR
foreach (...)
doSomething(); OR
foreach
(...
)
doSomething(); It's all syntactically the same and the compiler doesn't care. As Christian said, it's all a matter of readability. So long as you uphold the language specification, it doesn't really matter how you format your source code (unless you're one of those pseudo-languages like VB).
-----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-----
|
|
|
|
|
Ahh, you see... I didn't know that. I read this C# book and it told me that if I didn't want to use the {}'s on my loops I had to put the doSomething() right under the loop statment. EXACTLY ONE LINE DOWN. I never tried putting it anywhere else, I just though it was the rule.
That's cool, I know that know. Thanks for the incite.
/\ |_ E X E GG
|
|
|
|
|
Hi,
my class has a DateTime property. I would like to use the XmlSerializer and the DateTime Property should be written in RFC 822 format.
I guessed i can implement a typeconverter which can convert between DateTime and string (RFC822). But it seems like my typeconverter is never called.
[System.ComponentModel.TypeConverter(typeof(DateTimeRFCConverter))]
public DateTime PubDate
{get;set;}
is my idea basically wrong or did i missed something? Why use the XmlSerializer the DateTime typeconverter instead of my TypeConverter?
Thanks
.:[Greetz from Jerry Maguire]:.
|
|
|
|
|
XML serialization doesn't make use of a TypeConverter . It is hard-coded to format the intrinsic types and several common types like a DateTime . You could instead implement the IXmlSerializable interface. Though it's undocumented, it's pretty easy to figure out. Otherwise, you could create your own XmlSerializationReader and XmlSerializationWriter , but both are also undocumented and very complex. I'd recommend implementing IXmlSerializable on your class that contains the DateTime you want to format differently.
Also, you could always have a public property that returns and accepts a string in the format you want. You could use XmlIgnoreAttribute on the actual DateTime proeprty while using the value from the string property:
[XmlRoot("example")]
public class Example
{
[XmlIgnore]
public DateTime DT
{
get { return this.dt; }
set { this.dt = value; }
}
[XmlElement("dt")]
public string DTFormat
{
get { return this.dt.ToString("r"); }
set { this.dt = DateTime.Parse(value); }
}
} Note, using the format specifier "r" in DateTime.ToString says that it outputs a date-time in RFC 1123, but this RFC is not found the the format looks the same. Use a custom format if I am wrong.
-----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 Heath Stewart,
thanks, i guessed there is another way than implementing IXmlSerializable because everything works fine except the DateTime
this second property has to be public , right? Internal do not work.
.:[Greetz from Jerry Maguire]:.
|
|
|
|
|
Yes, only public properties and fields can be serialized using XML serialization in .NET. You'll notice that I made my property public.
If you don't want the property to show up in the designer or in the code editor, just attribute it like so:
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[XmlElement("dt")]
public string DTFormat
{
get { return this.dt.ToString("r"); }
set { this.dt = DateTime.Parse(value); }
}
-----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 Heath Stewart,
Good idea, but the important thing for me is that you do not see the property in intellisense. This confuse the developer
.:[Greetz from Jerry Maguire]:.
|
|
|
|
|
What do you think the EditorBrowsableAttribute is for?
-----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-----
|
|
|
|
|
|
The BrowsableAttribute keeps it hidden from the PropertyGrid (and any other component that honors this attribute). The EditorBrowsableAttribute hides it from the code editor. Reading documentation always helps.
-----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 building an application that connects to SQL Server. I'd like to allow the user to choose one of their defined ODBC connections.
Does .NET provide any classes to assist with determining the system/user defined DSN's?
Coding in the heartland
|
|
|
|
|
Yes, the ODBC DSN's are stored with the Windows registry. They are located in "LocalMachine\ODBC\ODBC.INI\ODBC Data Sources " and "CurrentUser\Software\ODBC\ODBC.INI\ODBC Data Sources " keys. There are many articles here on CP that discuss working with the registry under .NET. Does that help?
- Nick Parker My Blog
|
|
|
|