On PC’s in Europe and other countries who are using a comma as decimal sign, the string values will be converted to a whole value without the (Dot) decimal sign.
In the GUI; SEPIC maximal output voltage ’40.0’ will be changed to ‘400,0’ Volt and the Target current from ‘0.1’ to ‘1,0’ Amp. DANGER!
I’ll have add conversion software to the project to overcome this problem.
For your convenience I have included the source code. It works here, in Holland, fine but how it will work in US, I’ll don’t know, you may test it.
The following steps have to be done;
Add the file ‘Text.cs’ (remove the .txt) to the project,
In ‘LedBacklight.cs’;
- add a declaration
public _Text guiText;
//---initialization---
public LedBacklight()
{
guiText = new _Text(); guiText.New(this);
InitializeComponent();
- add references to guiText
//sldrs
sldrGroup[0] = new GuiSetSldr(sldrVsetSepic, txtVsetSepic, lblMinVsetSepic, lblMaxVsetSepic, 0x00, 9, guiText);
//sldrGroup[1] = new GuiSetSldr(sldrDutySetSepic, txtDutySetSepic, lblMinDutySetSepic, lblMaxDutySetSepic, 0x01, 0, GUIText);
sldrGroup[2] = new GuiSetSldr(sldrIsetLed1, txtIsetLED1, lblMinIsetLED1, lblMaxIsetLED1, 0x02, 14, guiText);
sldrGroup[3] = new GuiSetSldr(sldrIsetLed2, txtIsetLED2, lblMinIsetLED2, lblMaxIsetLED2, 0x03, 14, guiText);
sldrGroup[4] = new GuiSetSldr(sldrIsetLed3, txtIsetLED3, lblMinIsetLED3, lblMaxIsetLED3, 0x04, 14, guiText);
sldrGroup[5] = new GuiSetSldr(sldrIsetLed4, txtIsetLED4, lblMinIsetLED4, lblMaxIsetLED4, 0x05, 14, guiText);
sldrGroup[6] = new GuiSetSldr(sldrIsetLed5, txtIsetLED5, lblMinIsetLED5, lblMaxIsetLED5, 0x06, 14, guiText);
sldrGroup[7] = new GuiSetSldr(sldrIsetLed6, txtIsetLED6, lblMinIsetLED6, lblMaxIsetLED6, 0x07, 14, guiText);
sldrGroup[8] = new GuiSetSldr(sldrIsetLed7, txtIsetLED7, lblMinIsetLED7, lblMaxIsetLED7, 0x08, 14, guiText);
sldrGroup[9] = new GuiSetSldr(sldrIsetLed8, txtIsetLED8, lblMinIsetLED8, lblMaxIsetLED8, 0x09, 14, guiText);
In ‘GuiSetSldr.cs’ alter the proc’s ‘GuiSetSldr’: add _Text guiText at the end of the passing’s;
public GuiSetSldr(System.Windows.Forms.TrackBar slider, System.Windows.Forms.TextBox textBox, System.Windows.Forms.Label lblMinimumValue, System.Windows.Forms.Label lblMaximumValue, byte itemNumber, int q_Value, _Text guiText)
{
pass all string variables trough CheckNumber()
_value = Convert.ToDouble(guiText.CheckNumber(_txt.Text));
_txt.Tag = (int)_itemNum;
_sldr.Tag = (int)_itemNum;
int temp = ((int)Math.Pow(2, 15 - _qValue));
_lblMinVal.Text = Convert.ToDouble(_guiText.CheckNumber(lblMinVal.Text)).ToString("0.0");
_lblMaxVal.Text = Convert.ToDouble(_guiText.CheckNumber(lblMaxVal.Text)).ToString("0.0");
There will be more places where string values are not correct interpreted. If I find more I’ll add them here.
I’m a ‘beginners’ programmer in C#, so if you can imp roof the code feel free (and let me know the result).
Best regards,
Leo Bosch