Thread: Studio Express problem

  1. #1
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271

    Studio Express problem

    Hi

    I'm just starting to use the Visual C# Express 2008 IDE.
    I have the Following code:
    Code:
     using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    
    namespace WFATest
    {
        public partial class MainForm : Form
        {
            public MainForm()
            {
                InitializeComponent();
            }
    
            private void MainForm_Load(object sender, EventArgs e)
            {
    
            }
    //===================================================
            private void textBox1_TextChanged(object sender, EventArgs e)
            {
    
            }
    
            private void textBox2_TextChanged(object sender, EventArgs e)
            {
            
            }//================================================
    commenting this part out in visual Studio express causes errors despite the fact they do nothing. Can someone explain to me why this is?
    
            
            private void passToB_Click(object sender, EventArgs e) //This is button A
            {
                textBox2.Text = textBox1.Text;
                textBox1.ResetText();
            }
    
            private void passToA_Click(object sender, EventArgs e) //This is button B 
            {
                textBox1.Text = textBox2.Text;
                textBox2.ResetText();            
            }
            
        }
    }
    Which I intend to use to teach someone programming. The problem is Button B works perfectly but clicking A does nothing.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  2. #2
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    Probably because those text fields have events hooked up to them. Look at the lightning bolt in the properties of the text fields and see if there are events hooked up.
    Woop?

  3. #3
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    Thanks. Button A had nothing assigned.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  4. #4
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by WDT View Post
    Thanks. Button A had nothing assigned.
    Why are you checking Button A while commenting out events for TextBo1 and TextBox2?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  5. #5
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    I actually don't comment them out when I build the project. If I do it throws up errors. I just had it commented out here to see if someone can explain why taking out the commented section throws up errors.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  6. #6
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    I came across this:
    Code:
     if (GetRawInputDeviceList(pRawInputDeviceList, &nDevices, sizeof(RAWINPUTDEVICELIST)) == (<dtype rid="UINT"/>)-1) {Error();}
    I'd like to know what the part underlined in bold does.
    Also I'm still stuck with my original problem.

    I'm now understanding a little more about how to get around my original problem.
    It seems I need to PInvoke the DLL file in C# Whilst I've seen examples it fails to clarify a few things for me.

    After using the [DllImport("User32.dll")]
    a) Do I then need to define the structures of the types I need?
    b) Do I need to define/declare the functions I need?
    c) I have been reading through msdn. It says I need to wrap function in a class. so far I haven't seen an example of how I'd
    use the class after wrapping it in a class.


    Any help would be appreciated.
    Last edited by WDT; 03-26-2009 at 05:34 AM.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  7. #7
    Registered User
    Join Date
    Mar 2009
    Location
    england
    Posts
    209
    Code:
    [DllImport("user32.dll")]
    public static extern uint GetRawInputDeviceList(IntPtr pRawInputDeviceList, ref uint nDevices, uint rawInputDeviceListSize);

  8. #8
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    Thanks theoobe but I already had that.

    Still doesn't solve my problem.
    I'd just like a document a a few words explaining the process of platform Invoking. I'll take it from there.
    Any help in this would be greatly appreciated.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Visual Studio Express 2008 problems.
    By Normac in forum C++ Programming
    Replies: 2
    Last Post: 08-08-2007, 10:41 AM
  2. Crazy errors caused by class, never seen before..
    By Shamino in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2007, 11:54 AM
  3. debugger problem with VC++ express
    By Frenzied in forum C++ Programming
    Replies: 7
    Last Post: 07-18-2006, 03:33 PM
  4. Visual Studio 2003 Add New... problem
    By cboard_member in forum Tech Board
    Replies: 5
    Last Post: 06-19-2006, 03:30 AM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM