Troubles with parsing data from on function to another
-
Hi, I have a class where i'm creating a ButtonArray. Once i have created some elements in this array i want to access each of them in order to move them around in a panel. However i can't seem to get the information from the Move() funtion to be used in the MouseUpHandler which is the one handling the release of a button press (dropping the button at a new location). Could anyone please help me out here, and please do say if you need more code than i have provided. public void MouseUpHandler(object sender, System.Windows.Forms.MouseEventArgs e) { this.Move((System.Windows.Forms.Button) sender).Tag), host, _iXCoorRelative, _iYCoorRelative); } public void Move(object sender, System.Windows.Forms.Control host, int _iXCoorRelative, int _iYCoorRelative) { ButtonArray btnArray = new ButtonArray(host); btnArray[Convert.ToInt32(((System.Windows.Forms.Button) sender).Tag)].Location = new System.Drawing.Point (_iXCoorRelative, _iYCoorRelative); }
-
Hi, I have a class where i'm creating a ButtonArray. Once i have created some elements in this array i want to access each of them in order to move them around in a panel. However i can't seem to get the information from the Move() funtion to be used in the MouseUpHandler which is the one handling the release of a button press (dropping the button at a new location). Could anyone please help me out here, and please do say if you need more code than i have provided. public void MouseUpHandler(object sender, System.Windows.Forms.MouseEventArgs e) { this.Move((System.Windows.Forms.Button) sender).Tag), host, _iXCoorRelative, _iYCoorRelative); } public void Move(object sender, System.Windows.Forms.Control host, int _iXCoorRelative, int _iYCoorRelative) { ButtonArray btnArray = new ButtonArray(host); btnArray[Convert.ToInt32(((System.Windows.Forms.Button) sender).Tag)].Location = new System.Drawing.Point (_iXCoorRelative, _iYCoorRelative); }
Why does it "seem" like you can't get the information? What happens? Where do you declare the host, _iXCoorRelative and _iYCoorRelaive variables, and where do you specify the values for them? You send the contents of the Tag object of the button as sender to the Move method, then you reference the contents as a Button object. Do you really store a reference to a button in the Tag object of the button? --- b { font-weight: normal; }