|
The problem is most likely that a value has been entered into the textboxes that can't be converted in an Int16.
Usually this comes from not entering a value in the textbox. You can prevent that for generating an exception by doing this.
Convert.ToInt16(score.Text.Length == 0 ? 0 : score.Text)
If the textbox is required to be filled in then you need to validate it before using it. Also, you can prevent exception from invalid values like this
int scoreOut = 0;
if( int.TryParse(score.Text, out scoreOut) )
{
... valid value
}
only two letters away from being an asset
|
|
|
|
|
I remove this topic to WCF forum.
Sorry....
modified on Friday, October 23, 2009 12:08 PM
|
|
|
|
|
|
1. There is WCF forum.
2. Post the error message as well.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
|
Really I don't understand you. You say "You should also have asked this in the WCF forum as it is specific to that topic, not c# in general ".
Are you kidding?
Sorry again...
|
|
|
|
|
What don't you understand? The question was WCF related not a general C# question and as such should have been placed there. However, since you had received answers here it should have been left here.
Read the forum guidelines
6. Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
only two letters away from being an asset
|
|
|
|
|
I agree with the OP here. This is a WCF related post hence belongs to that forum. When the user does that, you cannot blame for reposting.
Mark Nischalke wrote: Delete the other before someone answers there
Is this in the poster's control?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
d@nish wrote: Is this in the poster's control?
Yes.
d@nish wrote: When the user does that, you cannot blame for reposting.
The damage was already done. As the forum guideline state
6. Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
only two letters away from being an asset
|
|
|
|
|
I'm new to C# coming from C/C++, hence the question. I'm receiving data from a tcp connection into a byte array. Then I want to send a portion of the contents on to another tcp connection. How do I do that? For example, I get 50 bytes but want to send out only from byte 25 to byte 50. How would I access and copy this "subarray" into another array?
Thanks
|
|
|
|
|
Array.Copy lets you copy arrays (full or segments) from one to another.
|
|
|
|
|
|
Dear Sirs,
I'm using a textbox control to display some text and the text on the right is appearing scrunched. It looks as though it displays the first x distance (I'm pretty sure it looks to be measured in distance, not characters) normally, and then squishes the characters (horizontally) taking out all character spacing so that they're not overlapping, but touching. Perhaps I'll give you a picture...I can't see how to insert one into the post, so I'll give you a link to my SkiDrive. My sky-drive photo. As you can see from the photo, the text is scrunched on one row, but not two rows down!! If you can tell me how to fix this, let me know. THANKS!!
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
one of three three things:
If you are "creating your own" text box.. I really recomend against it.. use the Rich text or normal text box... but if you are you are using GDI+ to do the drawing in which case you should be using Graphics.DrawString()... not cycling threw your characters.. this looks like what the problem is.. remember that if your want to use this approach that you will need to add in the letter padding manually (X+=3; ).
Now if that is not the case:
You may have inadvertently set a flag somewhere for your first string and then re initialized(clearing the flag) for the subsequent strings.
Lastly if you are using different fonts, or units of measure you may get a squinched string...
But you could post some code.. that might help.
|
|
|
|
|
Dear Mr. ely_bob,
Thanks for your response! You know what...now that you mention it, It might be using GDI+ that the text is being drawn. I just realized that the TextBox control is used for EDITING the value, not displaying it! I keep forgetting that it's programmed that way. I'll look at it. So you think that maybe what's happenning is that the x += 2; is not persisting; okay, I'll check it out. Thanks again.
[====EDIT====]
It looks like this is the code used to draw the strings:
context.Graphics.DrawString(label, _font, _brush, clipRect, _format);
Yup...just checked, and I see where it drew my string. So...let's see.
the arguments
label = "0.0\0.0\-25.0\0.0\0.0\-25.0\0.0\0.0\-25.0\0.0\0.0\-25.0\0.0\0.0\-25.0 "
_font = {[Font: Name=Microsoft Sans Serif, Size=8.25, Units=3, GdiCharSet=0, GdiVerticalFont=False]}
_brush = {System.Drawing.SolidBrush}
clipRect = {X=418,Y=768,Width=338,Height=16}
_format = {[StringFormat, FormatFlags=FitBlackBox, NoWrap, NoClip]}
Now, I'm reading about the format.FitBlackBox property, it says
"...By default, characters are repositioned to avoid any overhang." I would guess that this is the effect I'm complaining about, but after changing that, I still have the effect. Let me know what you think.
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
Dear All,
I have not used the datagridview in Windows applications, I am used to change the data before binding the data in ASP.Net. Is there such event in Windows side of Visual Studio 2008.
Thanks in advance for promt answer.
|
|
|
|
|
I am not sure that I totally understand your question but that doesn't normally stop me from trying to help.
Different Methods of Data Binding to a DataGridView[^] from here on Code Project might help you to get an understanding of the process.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
thank you.
|
|
|
|
|
I have to create the installer to install is SQL Server 2005 Express Edition.
-if the machine does not have it installed then install SQL server on it.
-If the machine has SQL server installed , the installer should show
the message that SQL express already installed -If there are any other errors during installation , the installer should be able to handle that display those errors.
Can anyone please help me on this?
With Regards,
Sona.
|
|
|
|
|
You can add SQL Server 2005 Exp as a prerequisite when you are making your deployment package.
|
|
|
|
|
help me plz!
"folder"
|
"folder music"
| |
| "folder music mp3"
| |
| "hero.mp3"
|
|
folder soft
In my situation: i have a tree like above, now i want to insert a file but i must check whether the folder( which contains this file) exists, whether the file exists.
if the file exist, dont insert.
if the folder doesnt exist, insert the folder in tree then insert the file in tree.
if the file doesnt exist, insert file
my node:
NodeTree Node = new NodeTree();
Node.Text = "helloworld.mp3";
Im a Newbie in C#
Plz help me!
Thanks in advance!
|
|
|
|
|
I f you take a look at C# File Browser[^] you will see that it contains a TreeView that displays folders, so studying the code might help you to get part way to your objective.
If that is a bit difficult to understand (you do say that you are a C# newbie) this[^] might be simpler.
For getting images to represent your files, you might also find Get Registered File Types and Their Associated Icons in C#[^] useful.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
thanks your help!
i just do with the tree with only "node contains text"( to studying) i dont want to make a file browser. Can you give me a bit of code, to do the problem above with the "node contain text"?
|
|
|
|
|
But your original question referred to checking for the existence of the folders and *.mp3s. What better way to do that than by walking the directory structure and adding only folders that contain files of interest (and the files themselves of course).
If you are doing something else, perhaps if you can explain what your app is trying to do and how you would like it to work, someone might be able to help you.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
your detail you gave me is very useful for me to study more.
but
i just want to examine the tree bases on the node's text.
and i did it,yeaz.
here is my code:
TreeNode nodeTemp = node1.Nodes.Find(temp[0].ToString(), true);//temp[] is an String Array
if (nodeTemp.Length == 0)
{
TreeNode node2 = new TreeNode();
node2.Name = "Hello!";
node2.Text = "Hello!";
node1.Nodes.Add(node2);
}
But i have a problem with node's text display in TreeView screen:
if i assign the Text of node is:"Hello!" but it is displayed in screen:"!Hello"
what's wrong for me!
|
|
|
|