Click here to Skip to main content
15,903,201 members
Home / Discussions / C#
   

C#

 
QuestionFinding base class of an object Pin
dashingsidds4-Jun-10 3:07
dashingsidds4-Jun-10 3:07 
AnswerRe: Finding base class of an object Pin
JoeSharp4-Jun-10 3:27
JoeSharp4-Jun-10 3:27 
AnswerRe: Finding base class of an object Pin
Anthony Mushrow4-Jun-10 3:45
professionalAnthony Mushrow4-Jun-10 3:45 
GeneralRe: Finding base class of an object Pin
dashingsidds4-Jun-10 4:25
dashingsidds4-Jun-10 4:25 
AnswerRe: Finding base class of an object Pin
#realJSOP4-Jun-10 4:52
professional#realJSOP4-Jun-10 4:52 
QuestionIssue with Environment.SpecialFolder.MyDocuments Pin
False Chicken4-Jun-10 2:09
False Chicken4-Jun-10 2:09 
AnswerRe: Issue with Environment.SpecialFolder.MyDocuments Pin
Johnny J.4-Jun-10 2:16
professionalJohnny J.4-Jun-10 2:16 
GeneralRe: Issue with Environment.SpecialFolder.MyDocuments Pin
False Chicken4-Jun-10 2:22
False Chicken4-Jun-10 2:22 
GeneralRe: Issue with Environment.SpecialFolder.MyDocuments Pin
Johnny J.4-Jun-10 2:23
professionalJohnny J.4-Jun-10 2:23 
Questioncolor get changed in another pc Pin
eraser9504-Jun-10 2:03
eraser9504-Jun-10 2:03 
AnswerRe: color get changed in another pc Pin
OriginalGriff4-Jun-10 2:26
mveOriginalGriff4-Jun-10 2:26 
AnswerRe: color get changed in another pc Pin
Hristo-Bojilov4-Jun-10 2:27
Hristo-Bojilov4-Jun-10 2:27 
QuestionConvert System.Drawing.Image to System.Web.UI.WebControls.Image Pin
Add44-Jun-10 0:55
Add44-Jun-10 0:55 
AnswerRe: Convert System.Drawing.Image to System.Web.UI.WebControls.Image Pin
Hristo-Bojilov4-Jun-10 1:55
Hristo-Bojilov4-Jun-10 1:55 
QuestionHow to control a outer application? [modified] Pin
imbiz3-Jun-10 23:46
imbiz3-Jun-10 23:46 
AnswerRe: How to control a outer application? Pin
Luc Pattyn4-Jun-10 0:38
sitebuilderLuc Pattyn4-Jun-10 0:38 
GeneralRe: How to control a outer application? Pin
imbiz4-Jun-10 2:20
imbiz4-Jun-10 2:20 
GeneralRe: How to control a outer application? Pin
Luc Pattyn4-Jun-10 7:18
sitebuilderLuc Pattyn4-Jun-10 7:18 
GeneralRe: How to control a outer application? [modified] Pin
imbiz4-Jun-10 21:39
imbiz4-Jun-10 21:39 
Questionlistbox Pin
kennyhibs3-Jun-10 22:30
kennyhibs3-Jun-10 22:30 
Hi can anyone help with the following

i use filesystemwatcher to watch a folder and add a new entry into a listbox everytime a new file is created, there is a second listbox that duplicates whats in the first but with some code allows me to change the file name via a text box, works ok as long as the item in listbox2 is highlighted when i change text, however if the listbox updates while i'm in process of changing text it removes the highlight from the item i'm editing and crashes if i press enter to confirm new file name.

Ther error i get is no doubt due to it not knowing what index to change as none are highlighted.
So how can i get it to keep the file i am changing name of highlighted until i enter the new text.

private void fileSystemWatcher1_Created(object sender, System.IO.FileSystemEventArgs e)
       {
           listBox1.Items.Add(e.FullPath);
           listBox2.Items.Add(e.FullPath);
           listBox1.SelectedIndex = listBox1.Items.Count - 1;
           listBox1.SelectedIndex = -1;
           listBox2.SelectedIndex = listBox2.Items.Count - 1;
           listBox2.SelectedIndex = -1;
       }

       private void listBox1_Click(object sender, EventArgs e)
       {
           listBox2.SelectedIndex = listBox1.SelectedIndex;
       }

       private void listBox2_Click(object sender, EventArgs e)
       {
           int itemSelected = this.listBox2.SelectedIndex;
           string itemText = this.listBox2.Items[itemSelected].ToString();

           Rectangle r = this.listBox2.GetItemRectangle(itemSelected);
           this.textBox1.Location = new System.Drawing.Point(r.X + 217, r.Y + 520);
           this.textBox1.Size = new System.Drawing.Size(r.Width + 4, r.Height - 10);
           this.textBox1.Visible = true;
           this.textBox1.Text = itemText;
           this.textBox1.Focus();
           this.textBox1.SelectAll();
       }

       private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
       {
           if (e.KeyChar == 13)
           {
               this.listBox2.Items[this.listBox2.SelectedIndex] = this.textBox1.Text;

               this.textBox1.Visible = false;
           }
           if (e.KeyChar == 27)
               this.textBox1.Visible = false;
       }

AnswerRe: listbox Pin
Peace ON3-Jun-10 23:34
Peace ON3-Jun-10 23:34 
GeneralRe: listbox Pin
kennyhibs4-Jun-10 21:39
kennyhibs4-Jun-10 21:39 
Questionwant to change theme of controls..... Pin
jainiraj3-Jun-10 19:54
jainiraj3-Jun-10 19:54 
AnswerRe: want to change theme of controls..... Pin
Johnny J.3-Jun-10 21:16
professionalJohnny J.3-Jun-10 21:16 
AnswerRe: want to change theme of controls..... Pin
Abhinav S3-Jun-10 21:31
Abhinav S3-Jun-10 21:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.