Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
E

electriac

@electriac
About
Posts
133
Topics
30
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • open filestream
    E electriac

    Does this appear to be correct?

    C# question discussion

  • open filestream
    E electriac

    I got this piece of code from, I know not where, as a recommended way to write to a file.

    // better way to write to file stream
    using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write))
    {
    StreamWriter sw = new StreamWriter(fs);
    sw.Write(textBox1.Text);
    sw.Close();
    }

    Any thoughts?

    C# question discussion

  • Left click works right does not
    E electriac

    I see from your posted link that a listView does have a right.mouse.button.click. I guess that's my best solution.

    C# question

  • Left click works right does not
    E electriac

    Thanks I guess I will have to write a custom listBox from scratch.

    C# question

  • Left click works right does not
    E electriac

    Tried same code on both Vis2008 and Vis2010 Express with the same result.

    C# question

  • Left click works right does not
    E electriac

    Clicking on an item. Left clicking item works. Right clicking item does not.

    C# question

  • Left click works right does not
    E electriac

    I do not understand why the right button does not work??

    namespace mouseclick
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    listBox1.MouseClick += new MouseEventHandler(listBox1_MouseClick);
    listBox1.Items.Add("aaaaaaaaaaaa");
    listBox1.Items.Add("aaaaaaaaaaaa");
    listBox1.Items.Add("aaaaaaaaaaaa");
    }

        void listBox1\_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                MessageBox.Show("Left Button"); // Works
            }
            if (e.Button == MouseButtons.Right)
            {
                MessageBox.Show("Right Button"); // Does not work  
            }
        }  
    }
    

    }

    C# question

  • DirectX9
    E electriac

    Markovl - TNX:

    C# question csharp

  • DirectX9
    E electriac

    This seems to be working. Any suggestions? I guess I will have to identify the OS and have an alternative for XP - right? Many thanks!

    public void readRegistryForDX9()
    {
    RegistryKey rk = Registry.LocalMachine;
    RegistryKey sk = rk.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX");
    string temp = (string)sk.GetValue("Version");
    if (temp.IndexOf("4.09")<0) MessageBox.Show("Directx 9 Must be installed");
    else MessageBox.Show("Directx 9 already installed");
    return;
    }

    C# question csharp

  • DirectX9
    E electriac

    I was able to do this on XP but I can't get any code to work on Win X64 could you give me an example. TNX

    C# question csharp

  • DirectX9
    E electriac

    In C# code how can I detect if Directx9 is installed on the user machine?

    C# question csharp

  • listBox Item Removal
    E electriac

    Since my list box is populated from several functions and has over 50,000 lines it would seem the simple "RemoveAt" solves the problem. But thanks for the clarification and example.

    C# question help

  • listBox Item Removal
    E electriac

    As I discovered but the listBox1.Remove is logical. Why create this special case.

    C# question help

  • listBox Item Removal
    E electriac

    Yeah! I will just add it to my list of MS idiosyncratic anomalies.

    C# question help

  • listBox Item Removal
    E electriac

    thanks for the explanation. I didn't feel I had an answer although the fix worked.

    C# question help

  • listBox Item Removal
    E electriac

    Found solution selLoc = listBox1.SelectedIndex; listBox1.Items.RemoveAt(selLoc);

    C# question help

  • listBox Item Removal
    E electriac

    //My list box contains some empty lines or lines just containing a "\t" and sometimes I want to remove one of these.
    //If the selected line contains text the line is removed without problem but when the selected line is blank "", " ", or "\t"
    // the removal goes to the first blank line and removes it rather than the selected line.

    selLoc = ListBox1.SelectedIndex;
    listBox1.Items.Remove(listBox1.SelectedItems[0]);
    // Removes The first occurance of empty line (not selected)

    // and this is the same
    listBox1.Items.Remove(listBox1.Items[selLoc]);
    // Removes The first occurance of empty line (not selected)

    //How can I remove a blank selected line?</pre>

    C# question help

  • Form loses focus [modified]
    E electriac

    Your right. I finally found the answer to the problem. The child form was not the problem. In the parent form I had done this:

    this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
    Form2 dlg = new Form2(fname);
    dlg.ShowDialog();

    For some reason this causes Form2 to be inactive I know not why.

    C# csharp linq graphics help question

  • Form loses focus [modified]
    E electriac

    If I click on the form all works as it should. I am writing a mediaplayer that functions from a IRremote so I dont want to have to click on the form with a mouse in order to read the key commands.

    C# csharp linq graphics help question

  • Form loses focus [modified]
    E electriac

    I'm afraid I still have the problem. I thought that the problem had been solved as clicking on the button caused the key commands to work. In actuality clicking the button was bringing the focus to the form. Here is the code with no button which loses focus.

    public WMP(string filename)
    {
    InitializeComponent();
    this.axWMP.KeyPressEvent += new AxWMPLib._WMPOCXEvents_KeyPressEventHandler(this.axWMP_KeyPressEvent);
    fname = filename;
    axWMP.settings.autoStart = false;
    axWMP.URL = fname;
    axWMP.Ctlcontrols.play();
    axWMP.Focus();
    }
    // At this point if I press a key the keystroke is reported to some other window.
    // If I click on this Window the keystroke will be reported here. How can I keep the
    // focus on this window.

        private void axWMP\_KeyPressEvent(object sender, AxWMPLib.\_WMPOCXEvents\_KeyPressEvent e)
        {
            label1.Text = "key press = " + e.nKeyAscii.ToString(); 
        }
    
    C# csharp linq graphics help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups