|
no..string[1] would be edate=3 and string[2] would be ""
|
|
|
|
|
Missed that - thanks.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Look into Regular Expressions.
Also see what I did here[^].
|
|
|
|
|
A simple Split will work for every ',' character into the original string, and it seems that it should ignore the ones which are between parenthesis. You can use regular expressions to achieve this. First of all, replace every ',' character which is between parenthesis with another character easy to replace back when split is finished ('|' could be a good choice). Then make a normal split, and then replace back. This code would work for the sample given:
string originalString = "sdate=2,edate=3,,frq=price(sdate=0,,),curn=usd";
Regex r=new Regex("\\(.+\\)");
string modified = r.Replace(originalString, m =>
{
return m.Value.Replace(',', '|');
});
string[] vector = modified.Split(',');
for (int i = 0; i < vector.Length; i++)
vector[i] = vector[i].Replace('|', ',');
Though vector[3] would be an empty string due to the two consecutive commas after the edate=3. If you want to ignore several consecutive commas into the string, you should make this before the split and after the replacement made by the Regex object:
while (modified.Contains(",,"))
modified = modified.Replace(",,", ",");
Hope this helps. See you
|
|
|
|
|
Hi Erik,
This is realy helpful...Thank you very much.
Thanks.
|
|
|
|
|
hello
i am working on a project "Face Detection" in live video without OpenCv, EmguCV etc. so the first thing that I want to access the RGB values of each pixel and then set them back after some plus minus calculation. but the problem is that i can't use GetPixel and SetPixel methods because they are too slow. and i need heigh speed. in one second i have to process many frames. my question is that is there any other way to get the rgb values and set them back more faster than GetPixel and SetPixel, which full fill my requirements?
thaks
|
|
|
|
|
See here[^].
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Sir I don't have words to say thanks to you. you solved a very big problem of mine. God bless you..thank you very much..
i would like to ask one another question and that is.
"Is BitmapData and lockBits and then Unlock bits through pointers is the fastest way to access bits or do we have more faster method then this as well?".
thanks
|
|
|
|
|
Hi all,
There are all these nice types of columns you can add to a DataGridView - ex. DataGridViewCheckBoxColumn and DataGridViewButtonColumn
Is there a way to define my own type for such a column?
What I'd like to do is this; I have a DataGridView on my form in which I display the various values of a list of attributes (I'm not using data binding). The different attributes have different types of values, some are strings, some are integers, some are dates and some are byte values that represent a bit field.
These bit fields I'd like to display in the DataGridView as a group of checkboxes . So I had in mind to create a control that consists of a panel containing 8 check boxes (or something like that) and then display that control in the DataGridView cell. But how?
Any ideas or suggestions would be appreciated.
TIA
|
|
|
|
|
This Link[^] may help you to get some idea
|
|
|
|
|
Hi, all.
I now it's a long posted issue but I have a problem with keyup in my serialport and I can't find a solucion.I Work with a richtextbox to access to the serial and works fine but not the keyup. in console app when I press keyup the machine connected via serialport gives me the last typed command. but not in richtextbox, here do nothing. catching the ConsoleKey/ConsoleKeyInfo in console app and sending the same data on richtextbox doesn't help.
How I can catch the keycode/keydata/keyvalue/ or something for the keyup in cons. app. to use it in richtextbox? seems to be different.
Thanks.
|
|
|
|
|
you have to pass the hex value for the UP key , richtextbox doe's not support the upkey to send the value to your device.., think about alternative..
see below link for hex value for control characters
http://www.gsp.com/cgi-bin/man.cgi?section=4&topic=keyboard[^]
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Hi Rajesh, Thanks for your answer.
I need a litle more help. I need to pass the string representation of the hex number of the upkey?
Iam trying this but doesnt work. may i not trying the on rigth way.
Thanks.
|
|
|
|
|
can u provide the code. what you tried.., so that i can help you on this...
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Hi. here is the code porcion.
private void rtBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == 38)//upkey
{
e.Handled = true; //for not executing on richtextbox directly the answer
//come from another function
serialPort1.Write("{0x26}");//This is the string representation of the
//hex keyup? I found more than one.
}
}
Thanks a lot for your time.
|
|
|
|
|
may be yoy are passing the wrong ASCII code,
0x26 for (Ctrl+Z),
Go through the below link , here all ASCII values are available
Ascii values[^]
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
i'm trying to get files with the a specified extension in a folder using a batch file , but when i give *.resource it doesn't get any file instead it shows "*.resource" with the path. ant idea how to get the file with the extension .resource .
thanx in advance.
|
|
|
|
|
Maybe I am extra thick today, but what does this have to do with C# ?
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
|
why you are using the batch file to get the file list..,
use the .net methods system.io.directory.getfiles to get the file list from directory..,
go throgh the below link
Get File list[^]
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
hi all,
i want a deskop notification from an xml file or from rss feed
with articles added when i be online
|
|
|
|
|
kjgiiy wrote: i want a deskop notification from an xml file or from rss feed
with articles added when i be online
And how do you plan to achieve this?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi - I am trying to send a simple string over an established Bluetooth connection using serial port. The probelm here is I don't know if what I am doing is correct as neither application are throwing any exceptions. Here is the code for the remote application
private void btnConnect_Click(object sender, EventArgs e)
{
try
{
SerialPort inPort = new SerialPort("COM2", 9600);
inPort.Open();
string message = "Hello";
inPort.Write(message);
inPort.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
On the other end I have used an event handler:
private void DataReceviedHandler(object sender, SerialDataReceivedEventArgs e)
{
try
{
SerialPort inPort = new SerialPort("COM7", 9600);
inPort.Open();
string mess = inPort.ReadLine();
MessageBox.Show("This worked...");
inPort.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
When I click on the button on the external application nothing happens? Any ideas????
|
|
|
|
|
There could be dozens of things wrong, getting a serial communication up and running requires all of them being right. Here are some suggestions:
- start by checking your physical connection by the simplest means, e.g. one party is constantly sending text (say one line every second), the other party uses HyperTerminal to receive them. Now experiment with cables, connectors, port settings, until characters are coming in.
- only when that works is it worthwhile expanding the software.
One immediate hint: ReadLine waits for a line of text, i.e. some characters ending on SerialPort.NewLine (which defaults to CR or LF or both, I can't remember). Your Write isn't sending any of them, try WriteLine.
|
|
|
|
|
private void DataReceviedHandler(object sender, SerialDataReceivedEventArgs e)
{
try
{
SerialPort inPort = new SerialPort("COM7", 9600);
inPort.Open();
string mess = inPort.ReadLine();
MessageBox.Show("This worked...");
inPort.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
in the above handler comport should be open previously, the receive comport should be open before sending the data by the sender comport.,
And also problem may be the comport settings as said in the above answer.., check all the comport settings are correct before starting your serialport communication.
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|