|
I think I must be missing something here - I can't see what's wrong with the code.
You create a new array holding the array as it's only element because that's the signature Control.Invoke expects. The array represents individual parameters, the fact there's only one and that it is itself an array is irrelevant.
But then, I think it should work so don't listen to me...
Regards,
Rob Philpott.
|
|
|
|
|
im confused either where im getting this wrong... anyone can try the code?
|
|
|
|
|
yes data is already an array. parameter in control.invoke refers to the number of parameters you pass this through in that case "upd" which is refered to Post_Results which contains only 1 param so thats the reason why you have to place the data into another array.
|
|
|
|
|
Never run into this situation but could you try what happens if you define the delegate as public.
Also as others pointed out, I don't see a reason to create a new array.
|
|
|
|
|
You have to create a new array because the outer array is the array of parameters TO PASS TO the called function, and the inner array IS the first parameter OF the called function. Since the called function takes an array as its first parameter...
|
|
|
|
|
Wouldn't casting work in this situation?
this.lvThreads.Invoke(upd, (object[])data);
|
|
|
|
|
I suspect that the exception is not being thrown here:
don234564 wrote: this.lvThreads.Invoke(upd, new object[] { data });
but somewhere here:
don234564 wrote: ListViewItem lvitem = (ListViewItem)data[0]; this.lvThreads.Items[lvitem.Text].SubItems[1].Text = Convert.ToString(data[1]);
And what you're actually experiencing is one of the whole panoply of wonders associated with multi-threading.
|
|
|
|
|
I have not actually found out whats really causing this but I re design my code and somehow got this to work.
here's what i'm using now.
private delegate void _Post_Result(object data);
private void Post_Result(object data)
{
if (lvThreads.InvokeRequired)
{
upd = new _Post_Result(Post_Result);
this.lvThreads.Invoke(upd, new object[] { data });
}
else
{
lvitem = (ListViewItem)data;
this.lvThreads.Items[lvitem.Index].SubItems[1].Text =
Convert.ToString(Convert.ToInt32(lvitem.SubItems[1].Text) + 1);
}
}
|
|
|
|
|
speech to text using neural networks in c#
any one knows about that plz send
|
|
|
|
|
You won't get that type of help here. If you get stuck on a specific problem, then come back. These types of posts will be scorned, so try not to do that. If you want code with no work whatsoever, go to this site[^].
|
|
|
|
|
I 'Scorn' upon your post
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
Lol, 5 for being funny, 1 for making fun of me. 5 for the smiley. 5+1+5/3 = 3.66~ rounded up to 5.
|
|
|
|
|
LOL, i demand a recount!!! The scorn was in-leauge with you, and aimed at the OP, they really need to learn
P.S should it be 5.0 + 1.0 + 5.0 / 3.0 if you want it to equal 3.66?
P.P.S Nevermind, i missed you already made that joke with the rounding lol
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
Scorn, I think you'll find is a noun, not a verb.
Regards,
Rob Philpott.
|
|
|
|
|
Certainly. Please send your credit card details, home address, phone number and photocopies of your signature to ExiledPrince@NigeriaMail.com. The next instant, all of your code will appear on your screen; you'll have to move out of the way though - my CodeRay is blocked by dense objects
Incidentally, a simple google search would have thrown up results regarding some of the new classes in the .Net Framework 3.5 running in Windows Vista; namely those of speech recognition. Then, you 'simply' integrate that with your own neural network
|
|
|
|
|
char a = 'A';
char b = 'B';
a = a + b;
a += b;
I thought they r both exactly the same thing. Can someone tell me whats the difference.Pl.
|
|
|
|
|
i think...
a = a + b;
is trying to assign a string (a + b) to a char (a)
where as..
a += b;
is taking them to be int values and adding 65 + 66 (ASCII values) and setting a to be 131
Atleast this is my understading
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
5'ed, I think that's correct but without looking it up I can't be sure. That makes the most sense.
|
|
|
|
|
The meaning of + operator depends on the types added together.
"A char can be implicitly converted to ushort, int, uint, long, ulong, float, double, or decimal. However, there are no implicit conversions from other types to the char type"
For chars the + is adding the integers together that are used for representing a single char. So in your first line the result is an int.
The second line contains automatically assignment so the result type cannot change (since you don't have an intermediate result) thus the operation results to a char. In the line having an error you must do casting explicitely to the intermediate result.
|
|
|
|
|
|
|
A colleague of mine is learning C#, as am I. I am ahead of him, so he asked me to help him figure out why his tiny test program isn't working. For the life of me I can't figure it out. Here's the code:
private void button1_Click(object sender, EventArgs e)
{
int tf = int.Parse(textBox1.Text);
int tc = 5 / 9 * (tf - 32);
label1.Text = tc.ToString();
}
This is supposed to convert the temperature in Fahrenheit (tf) to the temperature in celcius (tc). As far as I can tell it should work, but the value tc always comes out as 0. What am I overlooking?
|
|
|
|
|
Lodeclaw wrote: int tc = 5 / 9 * (tf - 32);
Integer devision, a common mistake for beginners, it happens to all of us.
5/9 is .5555 which is 0. Convert to doubles and try it then, should be fine after that.
|
|
|
|
|
|
No it isn't... I used same variable names...
double tf = double.Parse(textBox1.Text);
double tc = (5.0 / 9.0) * (tf - 32);
label1.Text = tc.ToString();
|
|
|
|