|
teejayem wrote: Is there a way to trim every character after a certian character.
Yes, Use IndexOf to find where the character is. And SubString to extract part of the string.
teejayem wrote: For instance i have a string like "12345.6789" is there a way to trim everything after the "." to show "12345"?
Strictly speaking if you were to trim everything after the "." the result would be "12345."
|
|
|
|
|
//you can write following code to the any button event, run it after finished //enter the keys
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.IndexOf('.'));
|
|
|
|
|
thanks colin, exactly what i needed!
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Try this the textBox1.Text will have the input string and the Result is available in the sResult. Messagebox will display all the string trimmed to the left of '.'
string s = textBox1.Text;
char [] carrSplit = new char[]{'.'} ;
string [] sResult = s.Split(carrSplit);
for(int i=0;i
|
|
|
|
|
Hi All
The problem is when im deleting a node form the tree view
it is removed but it is not deleted from the xml and it displays the node again on restarting the application Im using the code
string selectedNode = treeview.selectednodes.node;
node.remove(selected node);
so how will be it deleted form the xml also
SAS ![Rose | [Rose]](https://www.codeproject.com/script/Forums/Images/rose.gif)
|
|
|
|
|
You'll have to delete it from the Xml yourself. Presumably you know how to do this, we certainly can't help since you havn't provided any information as to how you're storing and/or reading/writing the data to the file.
I have no idea what I just said. But my intentions were sincere.
|
|
|
|
|
What XML? If you are using WPF and have "hard coded" the nodes in the Xaml, they will always be there on restart (they represent "initial conditions"). If you are building the tree by reading some other xml file, you will have to write code to do this...
|
|
|
|
|
selectedNode.Parent.RemoveChild(selectedNode); is about right.
Why are you asking the same question over and over. Any of the people who have tried to help you would have kept helping if you'd have answered their requests for more info.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi All
The problem is this that im setting these 4 properties from my application via comboboxes
[ 1 COM Port
2 Baud Rate
3 Parity
4 SopBits }
when the user selects the values from the combo boxes i want the value is also saved in the system as a default value
for example if one selects baud rate 9600 from the combo box so at the same time the system baud rate is also changed to 9600 same as if i change other values it is saved to the system
Could any on help me
SAS ![Rose | [Rose]](https://www.codeproject.com/script/Forums/Images/rose.gif)
|
|
|
|
|
I'm not sure that i understood ur question right, so tell me if this wat u meant
just make the attributes of the system static, so when u assign it from the combo box all the application can c it
|
|
|
|
|
Hello,
This may seem a stupid question to you, but i wanted to know that i downloaded the .netframework 3.0 and an addon for Visual stidio express C#, but its not giving up any visual development environment. how will that activate. Please guide..
Rahul.
|
|
|
|
|
The visual studio extensions do not include any visual designer add ons. The visual designer ("Cider") is a separate tool.
|
|
|
|
|
Dear Friends,
I am using the following code to read colored (24 bit) image into array, but when
I want to read black and white (1 bit image) it gives error
"AccessViolationException unhandled" "Attempted to read or write protected
memory. This is often an indication that other memory is corrupt.":
public static bool identifyLine(Bitmap imtooperated)
{
ArrayList blah = new ArrayList();
BitmapData bmData = new BitmapData();
Rectangle rect = new Rectangle(0, 0, imtooperated.Width,
imtooperated.Height);
bmData = imtooperated.LockBits(rect, ImageLockMode.ReadOnly,
imtooperated.PixelFormat);
int stride = bmData.Stride;
int range=0;
unsafe
{
byte* p = (byte*)(void*)bmData.Scan0;
for (int y = 0; y < imtooperated.Width; y++)
{
for (int x = 0; x < imtooperated.Height; x++)
{
blah.Add(p[range]); //here error comes
range++;
}
p += 1;
}
p += stride;
}
imtooperated.UnlockBits(bmData);
return true;
}
Please help.
|
|
|
|
|
dear code_explore
replace this line
bmData = imtooperated.LockBits(rect, ImageLockMode.ReadOnly,imtooperated.PixelFormat);
by
bmData = imtooperated.LockBits(rect, ImageLockMode.ReadOnly,PixelFormat1bppIndexed,imtooperated.PixelFormat);
you dont specify format for reading
reqarding...
eng. rizgar
|
|
|
|
|
Hi,
A couple of questions...
1) How do I capture the esc-key pressed event?
2) How do I track the progress of an sql query thrown to the server so that I can use this value to feed to my progress bar?
Thanks!
|
|
|
|
|
j11Software wrote: How do I capture the esc-key pressed event?
There is no specific event for the escape key. You capture it like any other key.
j11Software wrote: How do I track the progress of an sql query thrown to the server so that I can use this value to feed to my progress bar?
You don't. The server does not indicate the partial progress of a query.
If you are running a stored procedure that concists of several queries, you could store the status for each step into a table, and query that table to find out the progress.
---
Year happy = new Year(2007);
|
|
|
|
|
FYI,
if you want the ESC key to mean the same thing as pressing a specific Button on the
current form, you can set the Form.CancelButton property to point to that Button.
Luc Pattyn
|
|
|
|
|
How can I reduce image quality when I'm saving an image to reduce its size?
Thanks
|
|
|
|
|
One simple way is to change the resolution using Bitmap.SetResolution() method to a less value.
Regards
|
|
|
|
|
Thanks for reply but it doesn't help. I want to reduce file size.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
You can use the Quality encoder parameter, which works only with the JPEG encoder. Here's how to specify a quality level when saving an image:
ImageCodecInfo[] codecs=ImageCodecInfo.GetImageEncoders();
ImageCodecInfo codec = null;
foreach(ImageCodecInfo c in codecs)
{
if(c.MimeType=="image/jpeg")
{
codec=c;
break;
}
}
EncoderParameters encoderParams=new EncoderParams(1);
EncoderParameter encoderParam=new EncoderParameter(Encoder.Quality, 90L);
encoderParams.Param[0]=encoderParam;
bmp.Save(filename,codec,encoderParams);
|
|
|
|
|
Thanks for reply, but my files are in tif format.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
Unless the TIFF file uses JPEG compression (which is possible, but kind of pointless), the compression is lossless. That means that you can not change the quality of the compression as the compression does not make any quality compromises.
Unless you specifically need the TIFF format, you could try the PNG format instead. It is also lossless, but compresses a lot better. If you want lossy compression, use the JPEG format.
---
Year happy = new Year(2007);
|
|
|
|
|
I would like for the page to load and then for a process to kick off. The results of the process would then be updated on the page (via AJAX if I can ever get it to work). How do I do this?
|
|
|
|
|
It doesn't work that way. Well, it's possible using server push, but that requires that you start a component in the browser that establishes a permanent connection between the browser and the server, and even then you would have to re-attach it to the running process on the server.
Normally everything that you send between the server and the browser is initiated by the browser. The server can not send anything to the browser unless the browser is first sending a request to the server.
You can use AJAX to poll the server at a specific interval, so that the server could respond with the result. The running threads would have to store the results in a static list, so that the AJAX request could pick up the lastest result from a specific thread. You would also have to give each thread a unique identifier to identify the results, and keep the identifier in the page, so that it could be sent in the AJAX call in order to pick up the result from the correct thread.
---
Year happy = new Year(2007);
|
|
|
|