|
Multiple writer threads and a single reader thread, right?
The Synchronized() queue should indeed be fine for that.
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I have a navigation board(ToolStrip object) above a DataGridView object
I use this code to get data from it.
ToolStripTextBox_Row.Text = DataGridView_Country[0, grid_index].Value.ToString();
Ok, now i want to press Button_NextRow (in navigation board) and
set focus to next row in the DataGridView.
How can i do this?
|
|
|
|
|
It is currently displaying the stack upside down, the contents of the top of the stack are displayed as the last line in the text box. I am trying to make this code display the contents of the stack at the top of the text box.
private void displayStack()
{
string nextItem;
displayBox.Clear();
for (int i = 0; i <= stackTop; i++)
{
nextItem = stackArray[i].ToString();
displayBox.AppendText(nextItem);
displayBox.AppendText("\n");
}
}
|
|
|
|
|
Just loop the other way.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
How do I do that?
|
|
|
|
|
private void displayStack()
{
string nextItem;
displayBox.Clear();
// doing it the other way like guffa said
for (int i = stacktop; i >= 0; i--)
{
nextItem = stackArray[i].ToString();
displayBox.AppendText(nextItem);
displayBox.AppendText("\n");
}
}
instead of starting from bottom value of your stack,(originally your intial conditon is int i = 0) you are now starting at the max value of your stack.
Instead of stopping the loop when your variable "i" reaches "stacktop" (top of your stack), the loop stopped at "i = 0"(bottom of your stack).
Because of the above 2 statements, i++ have to change to i-- since you are starting from top to bottom now.
|
|
|
|
|
Thank you Lim and Guffa.It is now working exactly that way. Thank you so much!!!
|
|
|
|
|
Hi Friends
I got a task from my team lead to create a desktop news ticker.
If any one have code or else an helpfull link for the same, please reply back. Thanks in advance.
|
|
|
|
|
|
You need to fix the sign-up. Not working
|
|
|
|
|
What have you done so far, idea-wise?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I am doing research on it, I have not yet started writing code.
What actually I need is a scrolling text on my desktop which must not be a usual text but link and when any of the link is clicked, it should navigate to that particular page
|
|
|
|
|
I recall seeing a Marquee type of control in an article here on CP. I imagine if you can find it, you could create a custom control to have the text be a linkable hypertext. If one doesn't already exist here, it would be a cool article idea.
http://www.codeproject.com/KB/miscctrl/csmarquee.aspx[^] is one I found. Bet it could be customized for your purposes.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Thanks a lot paul. I will check it.
|
|
|
|
|
I was looking for something like that too, i going to check it out.
|
|
|
|
|
I am developing a major application that (among other things) talks to SQL Server databases. I have it built with a platform target of "Any CPU".
However, it has to be able to import legacy data from mdb databases. The Jet database engine is only available on the 32-bit platform. I have created a .NET assembly built with a platform target of "x86" for the main application to call to do the importing.
The problem is that I get a BadImageFormatException (0x8007000b) when trying to load the dll when running 64-bit Vista. There seems to be a division of opinion about whether the 64-bit framework should be able to load 32-bit dlls.
Does anyone have a definitive answer, or a solution to the problem? I really don't want to have to build the whole app to target 32-bit just for the sake of the mdb importing functions.
[update]
The 32-bit assembly also needs to be able to call into some of the other 64-bit assemblies. Maybe this is a killer anyway?
[/update]
Thanks in advance.
Phil
The opinions expressed in this post are not necessarily those of the author, especially if you find them impolite, inaccurate or inflammatory.
modified on Friday, August 1, 2008 11:35 AM
|
|
|
|
|
On a 64-bit x64 machine:
anycpu.exe -- runs as a 64-bit process, can load anycpu.dll and x64.dll, will get BadImageFormatException if it tries to load x86.dll
x86.exe -- runs as a 32-bit process, can load anycpu.dll and x86.dll, will get BadImageFormatException if it tries to load x64.dll
x64.exe -- runs as a 64-bit process, can load anycpu.dll and x64.dll, will get BadImageFormatException if it tries to load x86.dll
Ref:-
http://blogs.msdn.com/joshwil/archive/2005/04/08/406567.aspx[^]
Vikas Amin
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
Thanks for the link.
I've seen another blogger contradict that but I think my experience shows that the guy you link to is the one who's right.
I suppose I'll just have to drag everything down to x86 . Maybe one day I'll write a separate app to do the conversion.
Phil
The opinions expressed in this post are not necessarily those of the author, especially if you find them impolite, inaccurate or inflammatory.
|
|
|
|
|
In one of my project's , I remember we had two saperate build
one for 64-bit & one for 32-bit machine < although i dont like it >
We had to get/beg all 3-rd party dll to be 64-bit.
Vikas Amin
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
I'm trying to set a combo box on the forum to the corresponding item I'm passing it through the constructor, but it just ignores the value I'm passing it, and displays the first item in the combo box item collection. That data I'm trying to pass is taken from a deserialized XML file. Please let me know if there's anything else I need to provide you with for help Thanks.
this is how I'm binding the combo box's, in the designer.
this.cmbResults.DataSource = System.Enum.GetValues(typeof(PickItResult));
this.cmbQuality.DataSource = System.Enum.GetValues(typeof(D2Data.ItemQuality));
this.cmbItemType.DataSource = System.Enum.GetValues(typeof(D2Data.ItemType));
this.cmbItemClass.DataSource = System.Enum.GetValues(typeof(D2Data.ItemClass));
'the constructor I'm trying to set the combo box item in, i've tried many different things
public Requirements(string description, string mods, D2Data.ItemQuality quality, D2Data.ItemType type, D2Data.ItemClass itemClass, string stats, PickItResult result)
{
InitializeComponent();
this.description = description;
this.mods = mods;
this.quality = quality;
this.type = type;
this.itemClass = itemClass;
this.result = result;
this.stats = stats;
txtDescription.Text = description;
cmbResults.SelectedItem = Enum.Parse(typeof(PickItResult), result.ToString());
cmbQuality.SelectedItem = Enum.Parse(typeof(D2Data.ItemQuality), quality.ToString());
txtMods.Text = mods;
txtStats.Text = stats;
}
|
|
|
|
|
Try setting the SelectedItem property in the Form's FormLoaded handler. The underlying Windows combo box doesn't exist at the point you're doing it now.
Phil
The opinions expressed in this post are not necessarily those of the author, especially if you find them impolite, inaccurate or inflammatory.
|
|
|
|
|
thank you very much, this was driving me nuts. Figured it was something simple like this lol.
|
|
|
|
|
I am using 3rd party hardware and as a result, their software (off to a bad start) and their response to this question is deal with it. I can't change the hardware.
The problem is the hardware produces a 3 byte value which is stored as an int, ie in 4 bytes. The 3 bytes are stored in the three most significant bytes of the int and the least significant byte of the int is left as 0. If the 3 bytes were 12 34 56 they would be stored as 12 34 56 00. Thus if one tries to pull the bytes out as ints the appearance is the value has been multiplied.
My solution at the moment is to bit shift each element in the array by 8. The arrays can be large. Any ideas about a faster approach?
Thanks Jim
this thing looks like it was written by an epileptic ferret
Dave Kreskowiak
|
|
|
|
|
jimwawar wrote: Any ideas about a faster approach?
Probably not what you want to do in this case... but you can divide by 256, which gives me about a 5-10% improvement on my system, but I would test that with your setup.
Here's probably what you want to do.
You don't discuss your application but you should be able to write your application logic (the calculations and business algorithms) using the numbers as they are given to you by the hardware... as is. Do all the math, comparisons, and manipulation with respect to how the numbers are represented by the hardware. Then convert them to "normal numbers" only when they need to be presented to the end user.
Here's what I mean (and I am totally making up this example):
Let's say that your hardware is returning temperature data from a large series of sensors. You have to determine if the numbers are in an acceptable range (in my hyptothetical senario, 80,000 +/- 10,000 is acceptable). But the hardware gives you the data in the three-most significant bytes (it's giving you the bytes as 12 34 56 00, which is 203,569,152).
So, instead of writing:
for (int probeID = 0; probeID < 1000000; probeID++)
{
int data = GetProbeData(probeID);
data = data >> 8;
if (<code>data < 70000</code> || <code>data > 90000</code>)
Console.WriteLine("Value out of range: {0}", data);
}
Just write:
for (int probeID = 0; probeID < 1000000; probeID++)
{
int data = GetProbeData(probeID);
if (<code>data < 17920000</code> || <code>data > 23040000</code>)
Console.WriteLine("Value out of range: {0}", data >> 8);
}
That assumes that most of the processing time is spent gathering and manipulating the data and not displaying it, which is typically the case.
Oh, and I would probably keep all the number in hex (in the source code) so you can avoid all the conversions:
12 34 56 00 (from hardware) = 203569152 (0x0c223800 in hex)
00 12 34 56 (what you want) = 795192 (0x000c2238 in hex, easier to visualize the bytes)
Enjoy,
Robert C. Cartaino
|
|
|
|
|