Jump to content
Xtreme .Net Talk

solus

Avatar/Signature
  • Posts

    31
  • Joined

  • Last visited

About solus

  • Birthday 04/18/1982

Personal Information

  • Occupation
    Sales
  • Visual Studio .NET Version
    Microsoft Visual C# .NET 55603-652-0000007-18636
  • .NET Preferred Language
    c#

solus's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thanks, the APIs worked great. [DllImport("user32.dll",EntryPoint="FindWindow")] private static extern IntPtr FindWindow( string _ClassName, string _WindowName ); [DllImport("user32.dll")] private static extern uint ShowWindow( IntPtr hWnd, int nCmd ); IntPtr wp = FindWindow( null, "Window Name" ); ShowWindow( wp, 0 ); 0 to hide and 1 to show again. For future reference ;D
  2. I have a console program that runs as a type of server written by some one else. The fact that it sits in my taskbar is kind of irritating. Is there any way, using c#, to write a third party program that'll hide it from the taskbar and and my desktop entirely?
  3. I should have thought of that ;] Thanks, it worked great.
  4. Okay, best I can figure is at some point when you click an Item to select it, it's Selected Index is set to nothing. That would make ListView.SelectedItems[0] out of range. So to fix it i just surrounded it with a try{} and empty catch{} Not sure if that's bad practice =p but i'll use it until some one can come up with a better suggestion.
  5. Nope, checked that by commenting the line out.
  6. So I have a ListView and I want to get the Selected Item's value and compare it to anothre string when the item is selected: private void lstAccounts_SelectedIndexChanged(object sender, System.EventArgs e) { XmlElement Root = this.XmlDoc["accounts"]; foreach ( XmlElement account in Root.GetElementsByTagName( "account" ) ) { if ( this.lstAccounts.SelectedItems[0].Text == account["username"].InnerText ) { this.txtUsername.Text = account["username"].InnerText; this.txtPassword.Text = account["password"].InnerText; this.lstAccess.SelectedItem = account["accessLevel"].InnerText; } } } It works beautifully, but there's one probelm, it throws an exception if i click on the ListView a second time around and third and so on. It'll still do what it's supposed to, but throw an exception after the first time it's clicked on. What gives?
  7. Okay, xml not sortable...
  8. Okay, now I feel dumb. if ( Key == null ) { Key = Registry.CurrentUser.CreateSubKey( KeyPath ); }
  9. public string GetValue( string SubKey ) { RegistryKey Key = Registry.CurrentUser.OpenSubKey( KeyPath ); if ( Key.GetValue( SubKey ) != null ) { string Value = Key.GetValue( SubKey ).ToString(); Key.Close(); return Value; } else { return ""; } } This throws an exception: System.NullReferenceException: Object reference not set to an instance of an object. At Line: "if ( Key.GetValue( SubKey ) != null )" What am I doing wrong? Oo
  10. public void foo() { string sometext = "bar"; this.richTextBox1.Text += color; this.richTextBox1.Select((this.richTextBox1.Text.Length-sometext.Length), sometext.Length); this.richTextBox1.SelectionColor = System.Drawing.Color.Red; this.richTextBox1.Select(this.richTextBox1.Text.Length,0); } This works. First I append the text, select it, change the color and put the cursor back at the end of the box.
  11. this.txtMsg.ForeColor = System.Drawing.Color.Black; I have a multi-line TextBox that i'm appending with messages. I want to use different colored text for different types of messages. Obviously I can't set the ForeColor again, is there escape characters or something similar to use to accomplish this?
  12. Oh yeah, good idea =]
  13. I want it so the child window won't close unless the parent window is closed. Both bits of code effects both the child and parent so neither can be closed.
  14. override close event How can I override the close event on a child window so that i can cancel it being closed without effecting the parent window? Here's the code i'm using to cancel the close event in my child window: private void StatusForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { e.Cancel = true; } Here is the code I use to open the child window initially: StatusForm chStatusForm = new StatusForm(); chStatusForm.MdiParent = this; chStatusForm.Show();
  15. protected override void OnResize(EventArgs e_Resize) { base.OnResize( e_Resize ); do stuff }
×
×
  • Create New...