|
You best bet would probably be to use the TopItem[^] property.
You would need to get the index of the TopItem before updating the list, then restore the TopItem after the refresh. You will need to take into account the fact that the "saved index" may not exist in the updated list.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Or,you can use listView.EnsureVisible(index) ,it will let the item[index] auto visiable .. good luck
|
|
|
|
|
Playing around with the new SyncFramework is proving to be a pain. I can't get one demo application to work and the API Object Model is not as straight forward as one would think. That coupled with major changes of biblical proportions between the Betas and the CTPs is a sure recipe for mayhem.
I'm getting this exception thrown:
Exception: An error occurred when enumerating changes in the client database. Check the inner exception for more details.
InnerException: The column name is not valid. [ Node name (if any) = ut0,Column name = __sysInsertTxBsn ]
Now I got the code off of this article by Rafik Robeal: Clickety[^]
If anyone can shed some light on the subject, please do. I'm this close from giving up as I've been playing around with this framework since the 8th of January.
[edit]
I forgot to add that this issue occurs when the synchronization is set to Bidirectional[default for the demo app] or UploadOnly. Snapshot and DownloadOnly works fine (although the synchronization fails )
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
"There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib
"Animadvertistine, ubicumque stes, fumum recta in faciem ferri?"
|
|
|
|
|
Hi all,
I have a design question for an application I'm developing:
At the main GUI screen I'm having a list if items at a listView, where each entry represents a backstage complex object.
Backstage, I have a list of these objects (List<t>). The order of the items at the ListView is the order of the items at the list, meaning whenever I want to sort the ListView according to one of it's columns I'm sorting the list and then call an invalidate function to update the ListView. Think about the windows task manager as a model for this design: list of processes, which can be sorted according to several criterions (e.g name, CPU, mem usage etc.).
To me, it doesn't makes sense that whenever I'm sorting this view a big objects list is being sorted, and this design is causing several problems, for example: I can't sort the ListView while a certain task is running on the List, since the object's order will be changed and a whole mess will occure...
I'll appreciate any good ideas regarding how to separate the ListView from the object's list and still to be able to tie a ListView item with it's corresponding object in a fast and reliable way.
Thanks!
|
|
|
|
|
Good Day to all,
I've read article (http://www.codeproject.com/KB/cs/hard_disk_serialno.aspx ) here in CodeProject that is about retrieving the manufacturer's serial for a certain physical hard drive.
What I need is the one that can get the manufacturer's serial for a FLASH DRIVE, the usb type thing.
Is there any articles on how to do this?
PS: I'm after the real SERIAL, not the WMI type.
Thanks,
Ian
|
|
|
|
|
|
Yes there is. Sorry, that was a misfire. Submitted the original question.
|
|
|
|
|
Have you left a message for the author of the said article? There is a forum at the bottom of the article page.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
No, but someone already posted this same question. And the author seems to be already inactive.
|
|
|
|
|
MyReport rpt = new MyReport();
rpt.SetDataSource(MyDataset.Tables[MyTableName]);
rpt.SetParameterValue("MyParameter");
MyReportForm rptForm = new MyReportForm(rpt);
I was wondering if there's a smarter way to do maybe by converting my report once to object but then I cant access all the report's methods and members like the setting the datasource and the parameters.. I was thinking:
object rpt = new MyReport();
rpt.SetDataSource(MyDataset.Tables[MyTableName]);
rpt.SetParameterValue("MyParameter");
<font color="#00aadd">rpt = new AnotherReport();</font>
rpt.SetDataSource(MyDataset.Tables[MyTableName]);
rpt.SetParameterValue("MyParameter");
Thank you guys
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
EDIT: I reread and understood what was being asked.
You could use an interface or abstract class and do something like:
<br />
IReport rpt = new MyReport();<br />
rpt.SetDataSource(MyDataset.Tables[MyTableName]);<br />
rpt.SetParameterValue("MyParameter");<br />
<br />
rpt = new AnotherReport();<br />
rpt.SetDataSource(MyDataset.Tables[MyTableName]);<br />
rpt.SetParameterValue("MyParameter");<br />
where IReport is:
<br />
public interface IReport<br />
{<br />
void SetDataSource(DataTable source);<br />
void SetParameterValue(string parameter);<br />
}<br />
or if you want to use properties:
<br />
public interface IReport<br />
{<br />
DataTable DataSource { get; set; }<br />
string Parametervalue { get; set; }<br />
}<br />
Then have Report and AnotherReport implement the interface.
|
|
|
|
|
|
How would I, for every 10 numbers in an int, do an event? What I need help with is the foreach part? I'm confused as of what exactly to put: foreach (myInt in ???)
{
}
Thanks.
- I love D-flat!
|
|
|
|
|
Every 10 digits in what int ? You mean as in the int 12345678901 fires one event ? When ? When it's being entered ? If you have a string you can use the length property to check how long it is.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
int But I don't undertand how to calculate this in the language. foreach (myInt in (what goes here?)
- I love D-flat!
|
|
|
|
|
Convert the number to a string, then loop through the characters in that string.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
int.MaxValue is 2147483647. (Which is 10 digits).
Without using a 'bigger' space to store an integer (Int64) this will only 'fire' once if at all.
If this is true and you are using an int then if (myInt > 999999999)... will be sufficient.
If the integer is in string form then myStr.Length / 10 will give you the number of 'ten digits' there are in the string.
Matthew Butler
|
|
|
|
|
MasterSharp,
I think you've misunderstood the foreach slightly.
Foreach (int currentInt in myInt)
currentInt is the current int the foreach is at in the iteration.
myInt is the collection you want to iterate through.
So, if you wanted to fire an event every 10 digits, you could do:
int myInt = 100;<br />
int tenDigit = 0;<br />
foreach (int currentInt in myInt)<br />
{<br />
if (tenDigit == 10)<br />
{<br />
tenDigit = 0;<br />
<br />
If (Event != null)<br />
Event(this, new EventArgs());<br />
}<br />
<br />
tenDigit++;<br />
}
Hope this helps.
Regards,
Gareth.
|
|
|
|
|
Yes, thank you all.
- I love D-flat!
|
|
|
|
|
gareth111 wrote: int myInt = 100;
int tenDigit = 0;
foreach (int currentInt in myInt)
myInt is an integer. Foreach requires a collection, or some object that has an enumerator defined.
Small angry dogs
My 1000th post!!
|
|
|
|
|
Malcolm Smart,
Ye. My mistake, was thinking of just a normal for();
Regards,
Gareth.
|
|
|
|
|
In regards to Gareth's post, you can't use foreach on non-array objects.
|
|
|
|
|
Jordanwb,
See above.
Regards,
Gareth.
|
|
|
|
|
|
Hey all,
I would like, if possible, you could tell me some ideas for projects.
I have a friend who needs my help doing his final project but i run out of ideas. I think helping him will help me keep the C# programming skills i got from you guys.
Thanks so much, any help is greatly appreciate it!!
Best regards
Luis E Tineo S
|
|
|
|