[DllImport("cfront.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void DBL_BCD_2_Str(System.Text.StringBuilder _string, int strLength, string deciStr);
//bcd to string System.Text.StringBuilder sbuilder = new System.Text.StringBuilder(35); DBL_BCD_2_Str(sbuilder,35,textBox1.Text); textBox2.Text = sbuilder.ToString();input: "1234"
[DllImport("cfront.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void DBL_Str_2_BCD(System.Text.StringBuilder _string, string dateStr);
//string to bcd System.Text.StringBuilder sbuilder = new System.Text.StringBuilder(35); DBL_Str_2_BCD(sbuilder,textBox1.Text); textBox2.Text = sbuilder.ToString();input: "1234" other input: 0,00000000000000000000000000343332 (result bcd_2_str)
[DllImport("cfront.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void DBL_BCD_2_Double(System.Text.StringBuilder _value, string bcdstr);
//bcd to double System.Text.StringBuilder sbuilder = new System.Text.StringBuilder(35); DBL_BCD_2_Double(sbuilder,textBox1.Text); textBox2.Text = Convert.ToString(sbuilder.ToString());input: "1234"
[DllImport("cfront.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void DBL_Double_2_BCD( string bcdstr, double _value);
//double to bcd string getal = ""; DBL_Double_2_BCD(getal,Convert.ToDouble(textBox2.Text)); textBox2.Text = getal;input: "1234"
[DllImport("cfront.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void DBL_Date_2_Str(System.Text.StringBuilder _string, int strLength, string dateStr);
//date to string System.Text.StringBuilder sbuilder = new System.Text.StringBuilder(35); DBL_Date_2_Str(sbuilder,35,textBox1.Text); textBox2.Text = sbuilder.ToString();input: any date
[DllImport("cfront.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void DBL_Str_2_Date(System.DateTime date, string dateStr);
//string to date System.DateTime datum = new System.DateTime(); DBL_Str_2_Date(datum,textBox1.Text); textBox2.Text = Convert.ToString(datum);input: Any date
Comments
StringBuilder sbuilder = new StringBuilder();
DBL_BCD_2_Str(sbuilder,35,textBox1.Text);
textBox2.Text = sbuilder.ToString();
i think that the string builder is buid dynamic and if you put the length the string builder fill with ceros.
i hope that it's ok.