|
Why don't you give it a try? If you are lazy opening Visual Studio for such simple tests, you can use snippet compiler, it's quite a handy tool.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
i did try...
just wrote that bit of code as an example of what i mean by multiple conditions
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
case "hehe":
case "haha":
break;
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 )
|
|
|
|
|
|
You asked this question several hours ago. Why are posting it again? It's rude.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Dear All,
i am developing OMR application using c# and i would like to create or build my own defined kernel. what i mean is that I have a plus sign as a kernel image and now i would like to make or build my kernel based on that image using c#. please provide me references of how to build your own kernel ....
you are appreciated...
Abdul Rahaman Hamidy
Senior Student Student in Computer Science
Kabul, Afghanistan
Software Developer
|
|
|
|
|
You asked this question several hours ago and Christian Graus has answered you. Why are posting it again? It's rude. If you need to continue conversation reply to that message.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
How to insert data to a table in the database by using c# language?
|
|
|
|
|
|
Well, the trouble with your question is two fold
1 - we have to ask ourselves if it's worth helping someone who is unwilling to invest in a book, search the web, or show any signs of having tried to learn for themselves
2 - even if we were so inclined, we'd soon find that any help we tried to give would be limited given the typical length of a forum response, and the amount of detail required to properly cover the topic.
I recommend you read the article linked to in my sig, then type C# database insert into google. Typing the name of your database ( such as SQL Server, Oracle or Access ) will give you even more specific help.
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 )
|
|
|
|
|
cc is my ConnectionClass object.
cmd is SqlCommand object.
con is the object of SqlConnection
cc.cmd.Connection = cc.con;
cc.cmd.CommandText = "insert into tblName ([col1],[col2],...) values ('" + val1 + "','" + val2 + "',...)";
cc.cmd.ExecuteNonQuery();
Abdul Rahaman Hamidy
Senior Student Student in Computer Science
Kabul, Afghanistan
Software Developer
|
|
|
|
|
I want to load treeview nodes in background. Information about them are stored in an xml file
<node some="" info="">
<more info="" />
<subnode sth="" else="">
</subnode>
</node>
etc.
This file can be quite big and computers can be quite slow. So, I want to have a repsonding UI and TreeView items should appear one after another.
Of course, I did something, but it is dangerously close to a WTF zone. That's it:
1. Start some Load method in a new thread.
in the Load method:
2. Handle Menu.OnNodeLoaded event -> menu_OnNodeLoaded.
3. Call a function which reads data from a file, sth like. Menu.FromXml(...).
in that function:
4. Iterate throught an xml file.
5. Create a MenuNode object, which contain a Path property, e.g. "node/subnode"
6. Fire OnNodeLoaded.
in Window.menu_OnNodeLoaded:
7. Iterate through menuNode.Path to find a TreeViewItem place where a new TreeViewItem should be added.
8. Create a TreeViewItem and add it to the treeView.
How to do that better?
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
I'm trying to draw a line on the form in C#.
When i place the below draw line code in Form1_Load() method it does not draw the line when application starts. But if the same code is placed in Form1_Paint() method it works.
System.Drawing.Pen myPen = new System.Drawing.Pen(System.Drawing.Color.Red, 5);
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.DrawLine(myPen, 10, 10, 150, 200);
Why does the code not work in Form_Load(). Is is required that all graphics code needs to be executed in Form_Paint() method only?
|
|
|
|
|
Well, probably because in one case you did it properly, and in the other, you did not. CreateGraphics creates a graphics object that is invalidated the next paint event. So, it's for drawing temporary things. Forms are always invalidated after the form load event, so your code was never going to visibly work.
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 )
|
|
|
|
|
Thank you for your answer. Well i have another problem. On the form i have a groupbox. I want to draw line inside the groupbox. How can i do this?
|
|
|
|
|
you'll need to handle it's paint event and draw your line.
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 )
|
|
|
|
|
Hallo,
I am working with graphic object, in which I draw lines using g.drawline,also few lines are moving on mouse move function, I want to add tooltip on the lines, which diplay information abt line. I know tooltip only work for window controls and line is not window control, is there any way to do that?
thank you in advance
|
|
|
|
|
cooltoad123,
Only way i can think to do it is to check the MouseMove event and see if it hits the line with the mouse cords.
Regards,
Gareth.
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
No, the line is not an object, you will need to write the code to show that yourself.
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 )
|
|
|
|
|
hello
when i open richedit in microsoft word format of text disappear
how can solve this problem
|
|
|
|
|
When you open an rtf in Word, the format disappears ? Are you sure ?
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 )
|
|
|
|
|
Hi all,
I'm working on a project that contains a function for receiving files as "print jobs" using standard "Raw" Port9100 printing (also known as "JetDirect" printing, but this really has nothing to do with HP JetDirects).
The program should receive a print job and then save it as a file. The idea of the "Raw" protocol from everything I've read is essentially just that it is, as the name suggests, completely raw. A connection is established, the data is sent and the connection is closed. (if anyone knows differently, please let me know!)
I have some code that looks somewhat like this (inside a loop of course):
<br />
TcpListener tcpl = new TcpListener(IPAddress.Any, 9100);<br />
tcpl.Start();<br />
if (tcpl.Pending())<br />
{<br />
Socket newSocket = tcpl.AcceptSocket();<br />
if (newSocket.Connected)<br />
{<br />
NetworkStream ns = new NetworkStream(newSocket);<br />
StreamWriter sw = new StreamWriter(filename, false);<br />
if (ns.CanRead)<br />
{<br />
while (ns.DataAvailable)<br />
{<br />
sw.Write((char)ns.ReadByte());<br />
}<br />
}<br />
sw.Close();<br />
ns.Flush();<br />
ns.Close();<br />
newSocket.Close();<br />
}<br />
}<br />
It appears to "mostly" work. The problem is that the data I get in the file isn't exactly the data I would expect. The print job appears "mostly okay", but there is some actual corruption in the data and it won't print to the printer when passed on. The print driver is PCLXL, so I can't read it by sight (like PostScript or PCL5), but doing a comparison with a hex editor to a "print to file" of the same original, I can see massive corruption in the data itself - the PJL header (which is plain text) is totally fine. However in the data itself (after the header), there appears to be hex C3 (unsigned byte 195) interspersed right through the file.
I THINK this is probably the fault of the fact that I'm casting ns.ReadByte() to char , and it's modifying the data in some way. However, StreamWriter doesn't let me write the byte directly. I could however be wrong.
Can anyone offer another way I could do this that won't have this problem?
|
|
|
|
|
Hi
Why do you use StreamWriter anyway? the way you initialize it, it will load the UTF7 Encoding which might be the problem here.
you could use a simple FileStream and write the bytes you've read from the NetworkStream directly into the file.
oh and one more little thing: flushing the NetworkStream will not help you, since you're only reading from it. flush the FileStream instead
hope this helps
greets
M@u
|
|
|
|
|
You're completely correct and now I feel somewhat like an idiot!
But thanks, a very small change to use FileStream instead of StreamWriter has solved the problem.
|
|
|
|
|
Hi,
I am trying to load a assembly thru reflection using:
Assembly asm = domain.Load(AssemblyName)
I understand that the assembly should also be in the currrent directory (DEBUG folder) in order to load it, though it is present in te location specified.
I have tried setting a new location as my current directory before loading, using:
Directory.SetCurrentDirectory(...)
But still it is not loading the assembly though the dll is there in that path and NOT present in the DEBUG folder.
Can anyone help me with this?
Thanks,
Priya.
|
|
|
|