|
Maybe my thinking here is wrong, but how about simply clearing the listbox and re-add your object collection?
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Ok, thanks. I have just tried and it works.
|
|
|
|
|
Great
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
IMO removing and adding the collection is too much effort and causes flickering.
Invalidate() should be sufficient, unless you are in an event handler and want an immediate
repaint, if so use Refresh().
If that does not work for you, then something is wrong and you may want to show some code.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
The displayed text does change for my business object collection when bound to a list box.
Are you setting the items manually (using Add) or you set the DataSource to your object collection? Which interface did you implemented on the collection? (IList, BindingList, ICollection etc)?
Also check out the ListChangedEventArgs[^]
|
|
|
|
|
In my current project I need to customize ListView control's appearance. I need to change the groups heading style. Is there any way to do this ? I have inherited a new control from ListView class. But I couldn't find any helping methods to override. Anyone having any idea on doing this ?
Thanks
|
|
|
|
|
|
Thanks, I will check that
|
|
|
|
|
N a v a n e e t h wrote: I need to change the groups heading style.
First there is no single ListView Control, there are different versions of it. Some messages for the control like LVM_MOVEITEMTOGROUP are still documented as "not implemented". My interpretation of the Vista ListView documentation is that you can now assign an image from the controls image list to a Group. This might mean that you could use images to control the Group Header. I did not research the 3.0 BCL ListView to see if those messages have been included in the ListView class. However you could always do it yourself with C++/CLI or even *gulp* PInvoke.
led mike
|
|
|
|
|
led mike wrote: PInvoke.
Thanks. I was also thinking same. But problem is, my application is supposed to work under MAC too. So I am doing a MONO compilation for this. Pinvokes are not fully supported with MONO.
|
|
|
|
|
N a v a n e e t h wrote: my application is supposed to work under MAC too. So I am doing a MONO compilation for this.
That's probably something you want to say up front in all your future posts for that project.
led mike
|
|
|
|
|
Hi all,
So you have a table "Items" with 2 fields (SQL Server 2000):
Column Datatype Length Allow Nulls
-------------------------------------------
ItemID int 4 0
ItemPicture image 16 1
Now you want to insert a record with the ItemID=1 and with no picture (i.e. null).
So you do this (.NET 2.0):
string strSQL =
"insert into items (ItemID, ItemPicture) values(@ItemID, @ItemPicture)";
SqlCommand cmd = new SqlCommand(strSQL, GetDBConnection());
cmd.Parameters.AddWithValue("@ItemID", "1");
cmd.Parameters.AddWithValue("@ItemPicture", System.DBNull.Value);
if (cmd.Connection.State != ConnectionState.Open)
cmd.Connection.Open();
cmd.ExecuteNonQuery();
if (cmd.Connection.State != ConnectionState.Closed)
cmd.Connection.Close();
And you get an exception: "Operand type clash: nvarchar is incompatible with image".
Question:
So how can you insert a null value to an image field?
Thanks in advance,
Danny
|
|
|
|
|
DannyAdler wrote: So how can you insert a null value to an image field?
I have no idea. Can you not just insert a picture of size 1*1, or 0*0? Infact, does it even let you make a picture of 0*0?
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
The DBNull value is converted to a string, so you are actually trying to put the string returned by DBNull.ToString() (which is an empty string) into the field.
Specify the data type for the parameter:
cmd.Parameters.Add("@ItemPicture", SqlDbType.Image).Value = System.DBNull.Value;
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
When I first run my app and mini it to that system tray I can hover the mouse over it and it will show the correct text. If I show the form back to the screen and then hover the mouse over it says (1 runs). Now if I continue to mini and show this form the number increases (2 runs)... What is this?
|
|
|
|
|
Something in your code is updating the Text property of the NotifyIcon when restored from and minimized to tray.
|
|
|
|
|
Yep you are correct. I'm using some pretty cool code to clear out phantom icons from the system tray that changed my text. I have it all working now, thank you
|
|
|
|
|
Gene Arnold wrote: some pretty cool code
Well thank you sir.
TrayIconBuster checks all NotifyIcons once every 5 seconds by default, and shows how often
it did so far; this is unrelated to minimizing your app tho.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi All,
Is there a way to automatically refresh a control on the page without the user generating an event? For example, can I refresh a datagrid on a page every 5 seconds?
Thanks
|
|
|
|
|
Yup, set up a Windows.Forms.Timer (there's lots of different timers) set the interval to 5000.
And then inside you can call myControl.Update(); or myControl.Refresh(); or myControl.Invalidate(); .
One of those should probably do it.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
Thank you very much.Can i do that on asp.net page???
I would really appreciate if you can give me more tips on how to do it on a web page?
Thank you!!!
|
|
|
|
|
Well, i assume you wont be using the Windows.Forms.Timer on a webpage, but there are other timers, like, System.Timers.Timer
Apart from that, i don't know.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
You should look at the AJAX framework and the update panel.
|
|
|
|
|
I have an application that takes images and stores them automatically in a folder on my local drive. The application auto increments the file name by adding 1 to the last one taken. I name the images as photo_00001 and the next taken photo names as photo_00002. Now I want to look through the folder and select the last image taken that is the one with the highes name. Any ideas how I can achieve that?
a novice
|
|
|
|
|
Hi, there are a couple of solutions:
- use Directory.GetFiles() to get all the file names, then find the "highest" file name in those.
- use Directory.GetFiles() to get all the file names, then find the latest file by comparing
creation times using File.GetCreationTime()
- do a binary search for filenames that match your syntax, checking existence with File.Exists()
- teach your app to save the latest file name (a single string) in a fixed location, probably
a file in the same folder ("latestFile.txt").
- teach your app to save the latest file name (a single string) in the registry somewhere.
Probably not good:
- do a linear search for filenames that match your syntax, checking existence with File.Exists();
is slow and might return a hole in the sequence if you somehow deleted an older file.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|