themcnasty
Programmer
I am very new to C# and Visual studio and have the Express 2005 edition. Specifically, I have never created or imported a custom control nor have any idea how, despite a rudimentary understanding of inheritance and having downloaded a numeric control from the codeproject (and not knowing how to get it into a project).
I am basically making a GUI for connecting to proprietary hardware (a PLC for industrial automation). I will have lots of numeric values and a few strings and bools that will update real time AND many will allow user input. The numeric values come into C# already formated like so: "-1234.00" or "1234" depending on sign and if it is int or float (number of decimal places varies by number and may need to be truncated). Bools come in as "TRUE" or "FALSE"
I HAVE to do two things. First, the user needs to be able to input things on the windows side without effecting their value on the PLC until they are done typing (typing 134 will not send values of 1 then 13 then 134). I also need to not overwrite the field they are editing with the current PLC value. I was thinking a universal method that makes all text controls lose focus when the user presses enter. Then I could prevent the datapoint with focus from updating from the PLC or changing the PLC value. How do/can I make the enter key remove focus from txt controls while acting in the default manner otherwise?
Second, I have to be able to very easily and cleanly display numeric values correctly, with decimal and sign just as they appear in the automatically formated string and truncate floats with tons of decimal places. Easy you say, but I also must restrict user input to specified ranges of values and the proper numeric characters (including sign and decimal). For instance, one field may only allow values of 96 to 104 and values entered outside this range should automagically go to the nearest limit value when the control loses focus or the user presses enter. Or maybe the value is a USINT, I don't want '-' or '.' being entered!
can anyone tell me how to go about this? I'm not new to programming, just new to windows GUI and C#. The custom control I have from the codingproject seems to do what I want for numeric input but I have no freaking clue how to get it from Shorty.Windows.Forms.csproj to control in my toolbar (Using 2005 Express, so not full featured Studio)!
I am basically making a GUI for connecting to proprietary hardware (a PLC for industrial automation). I will have lots of numeric values and a few strings and bools that will update real time AND many will allow user input. The numeric values come into C# already formated like so: "-1234.00" or "1234" depending on sign and if it is int or float (number of decimal places varies by number and may need to be truncated). Bools come in as "TRUE" or "FALSE"
I HAVE to do two things. First, the user needs to be able to input things on the windows side without effecting their value on the PLC until they are done typing (typing 134 will not send values of 1 then 13 then 134). I also need to not overwrite the field they are editing with the current PLC value. I was thinking a universal method that makes all text controls lose focus when the user presses enter. Then I could prevent the datapoint with focus from updating from the PLC or changing the PLC value. How do/can I make the enter key remove focus from txt controls while acting in the default manner otherwise?
Second, I have to be able to very easily and cleanly display numeric values correctly, with decimal and sign just as they appear in the automatically formated string and truncate floats with tons of decimal places. Easy you say, but I also must restrict user input to specified ranges of values and the proper numeric characters (including sign and decimal). For instance, one field may only allow values of 96 to 104 and values entered outside this range should automagically go to the nearest limit value when the control loses focus or the user presses enter. Or maybe the value is a USINT, I don't want '-' or '.' being entered!
can anyone tell me how to go about this? I'm not new to programming, just new to windows GUI and C#. The custom control I have from the codingproject seems to do what I want for numeric input but I have no freaking clue how to get it from Shorty.Windows.Forms.csproj to control in my toolbar (Using 2005 Express, so not full featured Studio)!