|
hi, i want to remove a sequence of termination characters from network incoming message.
Assume the bytes recieved after encoding is "Data*Data*Data\0\0\0\0\0\0\0\0\0\0\0\0\0\0" i want to remove the all \0
|
|
|
|
|
you can use string.Remove(int index) and string.IndexOf(string value) to get the index of the "\0"s and remove it...
or you can use the string.Replace(string oldValue, string newValue) like this:
<br />
string message = "Data*Data*Data\0\0\0\0\0\0\0\0\0\0\0\0\0\0";<br />
message = message.Replace(@"\0", "");<br />
|
|
|
|
|
thanks for your reply, but i'm did it now and it doesn't work, but i tried another solution
Info = Info.Replace('\0',' ');
Info = Info.Trim();
for any one who wants to know thank you skatzteyp
|
|
|
|
|
oh yeah... '\0' is supposed to be an escaped character so treating it as string can't do the job... so using char solves it..
|
|
|
|
|
Darkman_nofear wrote: thanks for your reply, but i'm did it now and it doesn't work, but i tried another solution
Info = Info.Replace('\0',' ');
Info = Info.Trim();
The problem was that the escape code was not recognised as the string was prepended with @. You don't have to replace with spaces, just use:
Info = Info.Replace("\0", String.Empty);
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi... I created a MDI application and the parent form is trying to read a binary file and stored it in public 2D array, aiData[10240, 12]. I have a child form which will draw a graph from the data that is stored earlier on and I associated this draw method with the Paint() of the child form. The problem is when I tried to open a another binary file, the old graph is overwritten by the new data. So how can I keep the old graph while having the new graph displayed in another child form?
thanks.
|
|
|
|
|
You would be better off separating the data out as it seems to be entwined with the presentation logic here. Take a look at the MVC pattern to see how this could help you.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I have a datagridview in a windows form. I want to add an usercontrol in the datagridview. How can I do this?
|
|
|
|
|
Hello friends,
I have created a class library(MyClassLib). After giving sn name i registred it
to GAC with version 1.0.0.0 and 2.0.0.0
I have also added app.confg file which contains older and newer version of assembly.
when i run the program newer version get executed how can i specify to use older version.
I tried by interchaning older and newer version but it's not working
Please help me about this GAC.
Rahul Kulkarni
|
|
|
|
|
Ok by
default it always refers the latest one. But you want that it should actually use the older version.
You need to specify “bindingRedirect” in your config file. For instance
in the below case “ClassLibraryVersion” has two versions “1.1.1830.10493” and “1.0.1830.10461”
from which “1.1.1830.10493” is the recent version. But using the bindingRedirect we can specify
saying “1.0.1830.10461” is the new version. So the client will not use “1.1.1830.10493”.
<configuration>
<runtime>
<assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentassembly>
<assemblyidentity name="ClassLibraryVersion"
publickeytoken="b035c4774706cc72"
culture="neutral">
<bindingredirect oldversion="1.1.1830.10493"
newversion="1.0.1830.10461">
ok????
|
|
|
|
|
Math.Round(shortValue / intValue);
Error 1 The call is ambiguous between the following methods or properties: 'System.Math.Round(double)' and 'System.Math.Round(decimal)'
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Math.Round( ( double )shortValue / ( double )intValue );
|
|
|
|
|
Thanx again Mike
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
You're welcome. This is a basic type-relevant issue. Math cannot be taken for granted, so you probably want to heed Luc's advice if it affects your process.
|
|
|
|
|
short sVar;
sVar = sVar * 0.5;
Error 1 Cannot implicitly convert type 'double' to 'short'. An explicit conversion exists (are you missing a cast?)
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
short sVar;
sVar = sVar * ( short )0.5;
|
|
|
|
|
if you do not want to get zero all the time, use sVar=(short)(sVar*0.5);
but I prefer sVar=sVar/2;
|
|
|
|
|
Luc Pattyn wrote: but I prefer sVar=sVar/2;
Or:
sVar /= 2;
---
single minded; short sighted; long gone;
|
|
|
|
|
or sVar>>=1; Why make it obvious...
-- modified at 15:48 Thursday 17th May, 2007 because I owns
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Ummm... wouldn't that divide by four?
|
|
|
|
|
Yeah
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Thanx Mike
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
HI:
I have made an application which creates instances of word application locally and it is working fine but when i try to create intance of word application it gives me this error
Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005
Anybody knows the answer.
Thanx
|
|
|
|
|
Farhan Ali wrote:
I have made an application which creates instances of word application locally and it is working fine but when i try to create intance of word application it gives me this error
What do you mean, locally?
I think this error can happen when you dont have appropriate permissions, or maybe Word is not installed at all?
Take a look at Control Panels -> Administration tool -> Component Services -> dunno somewhere you should find settings for Word DCOM model. Good luck.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Hi friends..
string str="ABC";
this means that we are assigning value to the object str of string class..right?But whn we are instantiating some class then we are assigning values to the feilds of that class(ex:Employee_1.Name="xyz",Employee_1.Id=1234,etc where Employee_1 is an object of class Employee)..thn how things are working differently for string class..I think this has to do something with user defined and predefined reference data types..
-- modified at 2:52 Wednesday 16th May, 2007
|
|
|
|