|
what exactly i need to look for ?
and again, i would like to know what was wrong with the invoker ?
|
|
|
|
|
igalep132 wrote: what exactly i need to look for ?
DATABINDING
Does that help?!?
igalep132 wrote: what was wrong with the invoker ?
It is unnecessary! Learn to use the tools and techniques properly rather than trying to force something to make it work.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
thanks for being so angry...
|
|
|
|
|
ok, it still doesn't help !!
i still get the Cross-thread operation not valid: Control... exception when i'm trying to bind the dataGridView with the dataSet
so what should i do now ?
|
|
|
|
|
What do you mean by "it stucks when the event rises"? You sure it gets stuck and just doesn't add the row? In particular:
dataGridView2.Invoke(new MethodInvoker(delegate
{
dataGridView2.Rows.Add((object[])s);
}));
That code will never be fired if invoke is not required (that is, if dataGridView2.InvokeRequired is set to false). What you need is an "else" condition. See here for more information.
|
|
|
|
|
but in my case, invoke required, i'm running from different thread...
|
|
|
|
|
Ok, but you didn't answer my question. Answer that and maybe I can assist you.
|
|
|
|
|
i mean that the gui freezes...
|
|
|
|
|
Hmm, can you post a complete example to reproduce your problem? That way, I can debug it on my local computer and maybe give you some insight.
Until then, try this. Replace these:
dataGridView2.InvokeRequired
dataGridView2.Invoke
with these:
this.InvokeRequired
this.Invoke
Not sure that will work, but it's worth a try.
|
|
|
|
|
this.InvokeRequired<br />
this.Invoke doesn't work (i don't need invoke "this" object)
and about examp
give me your email, and i'll send it to you
|
|
|
|
|
I'm not going to give you my email address and I'm not going to run already compiled code. Create a simple example and paste the code here.
|
|
|
|
|
Hi codeproject World !
How can i convert string to decimal and remove unused Zero .
example :
string decimal = "192.0205000";
Decimal D = Decimal.Parse(decimal);
and wanna to have :
D = 192.0205
NOT D= 192.0205000
PLZ HELP !
|
|
|
|
|
And what is this code doing? Did even tried this?
|
|
|
|
|
Yes
it returns :
D= 192.0205000
BUT I wanna
<code>D= 192.0205 ====> Without unUsed Zeros</code>
|
|
|
|
|
Either strip the zeros off the string or use Math.Round
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
JYIS, they aren't there! They don't exist!
Edit: I posted that before I saw that you were using Decimal rather than Double.
ToString:
"
The return value is formatted with the general numeric format specifier ("G"), and the NumberFormatInfo object for the current culture.
"
G:
"
The exception to the preceding rule is if the number is a Decimal and the precision specifier is omitted. In that case, fixed-point notation is always used and trailing zeroes are preserved.
"
modified on Wednesday, April 28, 2010 9:38 PM
|
|
|
|
|
PIEBALDconsult wrote: JYIS
What does that mean?
PIEBALDconsult wrote: they aren't there! They don't exist!
The trailing zeroes? Yes they do. See here.
|
|
|
|
|
decimal d= decimal.Parse("1120.00120000",System.Globalization.NumberStyles.AllowDecimalPoint);
|
|
|
|
|
Just a minor point - in numeric terms, 1120.00120000 is exactly the same as 1120.0012. If you're doing a calculation using a decimal then it doesn't make much sense to round trim it.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Indeed, though there is a difference in some situations, such as when using ToString(). Try running this:
string strD = "192.0205000";
Decimal D = Decimal.Parse(strD);
MessageBox.Show(D.ToString());
I never knew that the Decimal data type actually maintains the trailing zeroes.
|
|
|
|
|
|
Excellent question! And thanks for providing the answer. I had no idea the Decimal data type stores trailing zeroes.
jojoba2011 wrote: PLZ HELP !
Just a bit of friendly advice... avoid using uppercase when not necessary, don't beg for help, and don't shorten words (e.g., "PLZ") except for common acronyms. To many people here at Code Project, it appears unprofessional. Other than that, though, great question.
EDIT: It appears your answer is incorrect.
|
|
|
|
|
This is merely a quirk of the "G" format; when ToString ing a Decimal, use something along the lines of d.ToString ( "#.###############" ) .
|
|
|
|
|
Good call. One can also use:
d.ToString("G29");
|
|
|
|
|
That's basically what the default is and I don't think it works.
|
|
|
|