public override void WriteComment(int nr, OrderedDictionary dic, List <PathEntry> path, string name) { WriteBaseComment(nr, dic); var ext = (OrderedDictionary)dic["extensions"]; if (ext != null) { if (ext.Contains("cmp")) { WriteCmpComment(dic, (string)ext["cmp"]); } } else if (dic.Contains("actual")) { WriteIsComment(dic, path); } var msg = (string)dic["message"]; if (msg != null) { Tw.WriteLine("# " + msg); } var backtrace = (string)dic["backtrace"]; if (backtrace != null) { string estring = Regex.Replace(backtrace, @"^", "# ", RegexOptions.Multiline); Tw.WriteLine(estring); } }
bool IMessageFilter.PreFilterMessage(ref System.Windows.Forms.Message m) { TwainCommand Tc = Tw.PassMessage(ref m); if (Tc == TwainCommand.Not) { return(false); } if (Tc == TwainCommand.Null)//by dh { return(false); } switch (Tc) { case TwainCommand.CloseRequest: case TwainCommand.CloseOk: EndScanning(); Tw.CloseSrc(); break; case TwainCommand.DeviceEvent: break; case TwainCommand.TransferReady: ArrayList LstPic = Tw.TransferPictures(); EndScanning(); Tw.CloseSrc(); string inhosTimes = txtTimes.Text; if (inhosTimes.ToString().Length == 1) { inhosTimes = "0" + inhosTimes; } for (int i = 0; i < LstPic.Count; ++i) { IntPtr Img = (IntPtr)LstPic[i]; Page++; string page = SetPage(Page); string fileName = LURecordNO.DisplayText + "_" + inhosTimes + "_" + page + "_00"; bmpptr = GlobalLock(Img); pixptr = GetPixelInfo(bmpptr); Gdip.SaveDIBAs(txtFolder.Text, fileName, bmpptr, pixptr); //保存图片 } DataTable data = CreatePictureDate(txtFolder.Text); pictureGrid.DataSource = data; if (data != null && data.Rows.Count > 0) { pictureView.FocusedRowHandle = data.Rows.Count - 1; } txtPage.Text = SetPage(Page + 1); break; //case TwainCommand.Null://by dh // EndScanning(); // Tw.CloseSrc(); // break; } return(true); }
bool IMessageFilter.PreFilterMessage(ref System.Windows.Forms.Message m) { TwainCommand Tc = Tw.PassMessage(ref m); if (Tc == TwainCommand.Not) { return(false); } if (Tc == TwainCommand.Null)//by dh { return(false); } switch (Tc) { case TwainCommand.CloseRequest: timer1.Stop(); break; case TwainCommand.CloseOk: EndScanning(); Tw.CloseSrc(); break; case TwainCommand.DeviceEvent: timer1.Stop(); break; case TwainCommand.TransferReady: timer1.Enabled = true; timer1.Interval = 10; timer1.Start(); ArrayList LstPic = Tw.TransferPictures(); //点击扫描按钮 EndScanning(); Tw.CloseSrc(); string inhosTimes = txtTimes.Text; if (inhosTimes.ToString().Length == 1) { inhosTimes = "0" + inhosTimes; } for (int i = 0; i < LstPic.Count; ++i) { IntPtr Img = (IntPtr)LstPic[i]; Page++; string page = SetPage(Page); string fileName = txtID.Text + "_" + inhosTimes + "_" + page + "_00"; bmpptr = GlobalLock(Img); pixptr = GetPixelInfo(bmpptr); Gdip.SaveDIBAs(txtFolder.Text, fileName, bmpptr, pixptr); //保存图片 } isSuccessEnd = true; //已完成 OnRefresh(null, null); //刷新图片采集主窗体 timer1.Stop(); this.Close(); break; } return(true); }
void WriteBaseComment(int nr, OrderedDictionary dic) { Tw.Write("# failed test {0} (", nr); var filename = (string)dic["file"]; if (filename != null) { Tw.Write("{0} at pos {1} ", filename, MkCoords(dic)); } Tw.WriteLine("in {0})", dic["method"]); }
public override string Refresh() { if (IsCreated) { return(base.Refresh()); } string rslt = Tw.CreateListApi(Name, !IsPublic, Description); IsCreated = string.IsNullOrEmpty(rslt); return(rslt); }
private void btnStart_Click(object sender, EventArgs e) { if (txtFolder.Text.Length > 0) { if (!msgfilter) { this.Enabled = false; msgfilter = true; Application.AddMessageFilter(this); } Tw.Acquire(); } }
public void MyInitializer() { tk = new Tk(); tw = new Tw(); mk = new Mk(); mw = new Mw(); nz = new Nz(); nw = new Nw(); d = new D(); oplossingen = new List <string>(); antwoord = ""; VulKlimatogram(); }
void WriteIsVal(bool leaf, OrderedDictionary dic, string label, string key, List <PathEntry> path, int side) { var val = dic[key]; if (leaf) { Tw.Write("{0}: '{1}'", label, SafeToString(val)); } else { Tw.WriteLine(" {0}:", label); var yw = new YAMLWriter(Tw, 4, TAP.HorizontalThreshold, BBD); yw.Annotate = (i, n) => { return(GetAnnotation(i, n, path, side, 0)); }; yw.Write(val); } }
void WriteIsComment(OrderedDictionary dic, List <PathEntry> path) { bool leaf = path == null || (YAMLWriter.IsLeafType(dic["actual"]) && YAMLWriter.IsLeafType(dic["expected"])); if (!leaf) { Tw.WriteLine("actual not as expected"); } WriteIsVal(leaf, dic, "got", "actual", path, 0); if (leaf) { Tw.Write(" "); } WriteIsVal(leaf, dic, "expected", "expected", path, 1); if (leaf) { Tw.WriteLine(); } }
private void AddSequence(Tw eener tweener) { if (tweener != null) { if (tweener.sequences == null) { tweener.sequences = new List <Sequence>(); } Sequence sequence = new Sequence(); sequence.nodes = new List <SequenceNode>(); sequence.events = new List <EventNode>(); int cnt = 0; while (tweener.sequences.Find(x => x.name == "New Sequence " + cnt.ToString()) != null) { cnt++; } sequence.name = "New Sequence " + cnt.ToString(); tweener.sequences.Add(sequence); selectedSequenceIndex = tweener.sequences.Count - 1; } }
void WriteBaseComment(int nr, OrderedDictionary dic, string name) { var filename = (string)dic["file"]; if (name == null) { name = ""; } else { name += ". "; } string todo = TAP.InTodo != null?"(todo) ":""; if (filename != null) { Tw.Write("{0}({1}): warning T{2}: {3}{4}", filename, MkCoords(dic), nr, name, todo); } else { Tw.Write("T{0} : {1}{2}", nr, name, todo); } }
void WriteCmpComment(OrderedDictionary dic, string cmp) { Tw.WriteLine("'{0}' {1} '{2}'", ValOrNull(dic, "actual"), cmp, ValOrNull(dic, "expected")); }
private void btnSelectScanner_Click(object sender, EventArgs e) { Tw.Select(); }
bool IMessageFilter.PreFilterMessage(ref System.Windows.Forms.Message m) { TwainCommand Tc = Tw.PassMessage(ref m); if (Tc == TwainCommand.Not) { return(false); } //if (Tc == TwainCommand.Null)//by dh //{ // return false; //} switch (Tc) { case TwainCommand.CloseRequest: case TwainCommand.CloseOk: EndScanning(); Tw.CloseSrc(); break; case TwainCommand.DeviceEvent: break; case TwainCommand.TransferReady: ArrayList LstPic = Tw.TransferPictures(); EndScanning(); Tw.CloseSrc(); string inhosTimes = txtTimes.Text; if (inhosTimes.ToString().Length == 1) { inhosTimes = "0" + inhosTimes; } for (int i = 0; i < LstPic.Count; ++i) { IntPtr Img = (IntPtr)LstPic[i]; Page++; string page = SetPage(Page); string fileName = LURecordNO.DisplayText + "_" + inhosTimes + "_" + page + "_00"; bmpptr = GlobalLock(Img); pixptr = GetPixelInfo(bmpptr); Gdip.SaveDIBAs(txtFolder.Text, fileName, bmpptr, pixptr); //保存图片 } for (int i = 0; i < LstPic.Count; ++i) //回收内存 { IntPtr Img = (IntPtr)LstPic[i]; Marshal.FreeHGlobal(Img); } DataTable data = CreatePictureDate(txtFolder.Text); pictureGrid.DataSource = data; if (data != null && data.Rows.Count > 0) { pictureView.FocusedRowHandle = data.Rows.Count - 1; } txtStartPage.Text = SetPage(Page + 1); LstPic.Clear(); //GC.SuppressFinalize(this); GC.Collect(); //回收内存 //dibhand = IntPtr.Zero; //bmpptr = IntPtr.Zero; //pixptr = IntPtr.Zero; //Marshal.FreeCoTaskMem(dibhand); //Marshal.FreeCoTaskMem(bmpptr); //Marshal.FreeCoTaskMem(pixptr); //Marshal.FreeHGlobal(dibhand); //Marshal.FreeHGlobal(bmpptr); //Marshal.FreeHGlobal(pixptr); break; } return(true); }
private void btnSelectScanner_Click(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Tw.Select(); }
private void radButton1_Click(object sender, EventArgs e) { double Dscd2, Ge2, Dscd3, Ge3, Dscd4, Ge4; WEIRHIGHTradTextBox1.Text = valueofh().ToString(); if (PeakradTextBox1.Text == "" || widthreverradTextBox4.Text == "" || tailwaterradTextBox6.Text == "" || MeanradTextBox1.Text == "" || rivrbedradTextBox10.Text == "" || depthdownradTextBox11.Text == "" || depthupradTextBox2.Text == "" || WeirbodycomboBox1.Text == "" || PercentagecomboBox1.Text == "" || TypeofcomboBox1.Text == "") { MessageBox.Show("You have left a Required field empty", "message", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } else { Qp = Convert.ToDouble(PeakradTextBox1.Text); LR = Convert.ToDouble(widthreverradTextBox4.Text); d3 = Convert.ToDouble(tailwaterradTextBox6.Text); mr = Convert.ToDouble(MeanradTextBox1.Text); RBL = Convert.ToDouble(rivrbedradTextBox10.Text); DGd = Convert.ToDouble(depthdownradTextBox11.Text); DGu = Convert.ToDouble(depthupradTextBox2.Text); if (WeirbodycomboBox1.Text == "Concrete") { wb = 2.3; } else if (WeirbodycomboBox1.Text == "Masonary") { wb = 2.4; } else if (WeirbodycomboBox1.Text == "Cement Mortar") { wb = 2.1; } else if (WeirbodycomboBox1.Text == "Reinforced Concrete") { wb = 2.45; } if (PercentagecomboBox1.Text == "10%") { X = 0.1; } else if (PercentagecomboBox1.Text == "15%") { X = 0.15; } else if (PercentagecomboBox1.Text == "20%") { X = 0.12; } if (TypeofcomboBox1.Text == "Fine Sand") { c = 15; Gex = 0.17; } if (TypeofcomboBox1.Text == "Coarse Sand") { c = 12; Gex = 0.2; } if (TypeofcomboBox1.Text == "Sand Mixed with boulder") { c = 9; Gex = 0.25; } if (TypeofcomboBox1.Text == "tight Sand") { c = 8; Gex = 0.25; } } // calculation began here Q = (1 - X) * Qp; L = (1 - X) * LR; He = Math.Pow(Q / (1.71 * L), (double)2 / 3); //hdrandresult = (2 * He) / 3; // d1randval = (2 * (valueofh() + He)) / 3; hdrandresult = hdrand(Hd, He, Q, L, Qp); d1randval = d1rand(d1, valueofh(), He, Q, L, hdrandresult); q = Q / L; v1 = q / d1randval; Fr = v1 / Math.Sqrt(d1randval * g); d2 = (double)d1randval / 2 * ((Math.Sqrt(1 + (8 * Math.Pow(Fr, 2)))) - 1); v2 = q / d2; d = d2 - d3; //value pass for norandfucction double d1d = (2 * (valueofh() + d + He)) / 3; if (d < 0.4) { d = 0; if (Fr < 2.5) { energyradTextBox1.Text = "DON'T USE ENERGY DISSIPATOR"; } else { if (Fr > 2.5 && Fr < 4.5) { energyradTextBox1.Text = "USE TYPE IV"; } else { if (Fr < 10) { if (v1 < 18) { energyradTextBox1.Text = "USE TYPE III"; } else { energyradTextBox1.Text = "USE TYPE II"; } } else { energyradTextBox1.Text = "USE BUCKET TYPE"; } } } DepthofCisterntextbox.Text = d.ToString(); } else { d1randval = nodrand(d1d, d, valueofh(), Q, He, L, d1randval); // d1randval= (2 * (valueofh() + d + He)) / 3; v1 = q / d1randval; Fr = v1 / (Math.Sqrt(g * d1randval)); d2 = ((double)d1randval / 2) * (Math.Sqrt((1 + 8 * (Math.Pow(Fr, 2))))); v2 = q / d2; if (Fr < 2.5) { energyradTextBox1.Text = "DON'T USE ENERGY DISSIPATOR"; } else { if (Fr > 2.5 && Fr < 4.5) { energyradTextBox1.Text = "USE TYPE IV"; } else { if (Fr < 10) { if (v1 < 18) { energyradTextBox1.Text = "USE TYPE III"; } else { energyradTextBox1.Text = "USE TYPE II"; } } else { energyradTextBox1.Text = "USE BUCKET TYPE"; } } } DepthofCisterntextbox.Text = d.ToString(); } // code for finding downstream bed leve double DsBL = downstreambedlevel(RBL, valueofh(), He, hdrandresult, d3, d2); // code for finding the top width of a weir body and bottom witdth of weir body Tw = He / (Math.Sqrt(wb - 1)); Bw = Tw + (valueofh() / (Math.Sqrt(wb - 1))); topwidthradTextBox2.Text = Tw.ToString(); BottomwidthradTextBox4.Text = Bw.ToString(); //code for finding uper stream cd and down stream cd double f = 1.76 * (Math.Sqrt(mr)); double R = 1.35 * (Math.Pow(q / f, (double)2 / 3)); double UsHFL = RBL + valueofh() + He; if (R > 2.5) { R = 2.5; DsHFL = RBL + d3; DsCL = DsHFL - (2 * R); DsCd = RBL - DsCL; UsCL = UsHFL - (1.5 * R); UsCd = RBL - UsCL; if (DsCd <= DGd) { downsstreamcutoofradTextBox6.Text = DGd.ToString(); } if (DsCd >= DGd) { DsCd = DGd; downsstreamcutoofradTextBox6.Text = DsCd.ToString(); } if (UsCd <= DGu) { upstramcuttoffradTextBox5.Text = DGu.ToString(); } if (UsCd >= DGu) { UsCd = DGu; upstramcuttoffradTextBox5.Text = UsCd.ToString(); } } else { DsHFL = RBL + d3; DsCL = DsHFL - (2 * R); DsCd = RBL - DsCL; UsCL = UsHFL - (1.5 * R); UsCd = RBL - UsCL; if (DsCd <= DGd) { downsstreamcutoofradTextBox6.Text = DGd.ToString(); } if (DsCd >= DGd) { DsCd = DGd; downsstreamcutoofradTextBox6.Text = DsCd.ToString(); } if (UsCd <= DGu) { upstramcuttoffradTextBox5.Text = DGu.ToString(); } if (UsCd >= DGu) { UsCd = DGu; upstramcuttoffradTextBox5.Text = UsCd.ToString(); } /* UsCd = DGu; * DsCd = DGd; * downsstreamcutoofradTextBox6.Text = DsCd.ToString(); * upstramcuttoffradTextBox5.Text = UsCd.ToString();*/ } DsCd = DGd; UsCd = DGu; //CODE FOR CALCULAING LENGTHOF UPSTREAM APRON ,LENGTHOF DOWNSREAM APRON(LDS) AND STILLING BASINE.................. H = ((RBL + valueofh() + He) - DsBL); Lb = c * H; ldsa = 3.87 * c * (Math.Sqrt(Math.Abs(H / 10))); Ls = 5 * d2; lds = ldsa - Ls; Lus = Lb - ((2 * UsCd) + Bw + ldsa + (2 * DsCd)); if (Lus > 0) { AL = (Lus + Bw + Ls + lds) / DsCd; lamda = (1 + (Math.Sqrt(1 + (Math.Pow(AL, 2))))) / 2; Ge = valueofh() / DsCd * (1 / (Math.PI * (Math.Sqrt(lamda)))); if (Ge < Gex) { lengthofdownradTextBox8.Text = ldsa.ToString(); lengthofupradTextBox7.Text = Lus.ToString(); lengthofstillingradTextBox9.Text = Ls.ToString(); } Dscd2 = DsCd + 0.2; AL = (Lus + Bw + Ls + lds) / Dscd2; lamda = (1 + (Math.Sqrt(1 + (Math.Pow(AL, 2))))) / 2; Ge2 = valueofh() / Dscd2 * (1 / (Math.PI * (Math.Sqrt(lamda)))); if (Ge2 < Gex) { lengthofdownradTextBox8.Text = ldsa.ToString(); lengthofupradTextBox7.Text = Lus.ToString(); lengthofstillingradTextBox9.Text = Ls.ToString(); } Dscd3 = DsCd + 0.3; AL = (Lus + Bw + Ls + lds) / Dscd3; lamda = (1 + (Math.Sqrt(1 + (Math.Pow(AL, 2))))) / 2; Ge3 = valueofh() / Dscd3 * (1 / (Math.PI * (Math.Sqrt(lamda)))); if (Ge3 < Gex) { lengthofdownradTextBox8.Text = ldsa.ToString(); lengthofupradTextBox7.Text = Lus.ToString(); lengthofstillingradTextBox9.Text = Ls.ToString(); } Dscd4 = DsCd + 0.4; AL = (Lus + Bw + Ls + lds) / Dscd4; lamda = (1 + (Math.Sqrt(1 + (Math.Pow(AL, 2))))) / 2; Ge4 = valueofh() / Dscd4 * (1 / (Math.PI * (Math.Sqrt(lamda)))); if (Ge4 > Gex) { lengthofdownradTextBox8.Text = ldsa.ToString(); lengthofupradTextBox7.Text = Lus.ToString(); lengthofstillingradTextBox9.Text = Ls.ToString(); } } else { Lus = 2.5; AL = (Lus + Bw + Ls + lds) / DsCd; lamda = (1 + (Math.Sqrt(1 + (Math.Pow(AL, 2))))) / 2; Ge = valueofh() / DsCd * (1 / (Math.PI * (Math.Sqrt(lamda)))); if (Ge < Gex) { lengthofdownradTextBox8.Text = ldsa.ToString(); lengthofupradTextBox7.Text = Lus.ToString(); lengthofstillingradTextBox9.Text = Ls.ToString(); } Dscd2 = DsCd + 0.2; AL = (Lus + Bw + Ls + lds) / Dscd2; lamda = (1 + (Math.Sqrt(1 + (Math.Pow(AL, 2))))) / 2; Ge2 = valueofh() / Dscd2 * (1 / (Math.PI * (Math.Sqrt(lamda)))); if (Ge2 < Gex) { lengthofdownradTextBox8.Text = ldsa.ToString(); lengthofupradTextBox7.Text = Lus.ToString(); lengthofstillingradTextBox9.Text = Ls.ToString(); } Dscd3 = DsCd + 0.3; AL = (Lus + Bw + Ls + lds) / Dscd3; lamda = (1 + (Math.Sqrt(1 + (Math.Pow(AL, 2))))) / 2; Ge3 = valueofh() / Dscd3 * (1 / (Math.PI * (Math.Sqrt(lamda)))); if (Ge3 < Gex) { lengthofdownradTextBox8.Text = ldsa.ToString(); lengthofupradTextBox7.Text = Lus.ToString(); lengthofstillingradTextBox9.Text = Ls.ToString(); } Dscd4 = DsCd + 0.4; AL = (Lus + Bw + Ls + lds) / Dscd4; lamda = (1 + (Math.Sqrt(1 + (Math.Pow(AL, 2))))) / 2; Ge4 = valueofh() / Dscd4 * (1 / (Math.PI * (Math.Sqrt(lamda)))); if (Ge4 < Gex) { lengthofdownradTextBox8.Text = ldsa.ToString(); lengthofupradTextBox7.Text = Lus.ToString(); lengthofstillingradTextBox9.Text = Ls.ToString(); } }//ENDING OF RADBUTON FOR WIR BODY //END FOR CALCULATING LDS, LUS AND LS APRONS...................................................................... //ALGORITHM FOR DOWNSTREAM FLOOR THICKNESS....................................................................... double Hdyn = He + valueofh(); double Lc = (2 * UsCd) + (Lus + Bw + Ls + lds + (2 * DsCd)); double Lpa = (2 * UsCd) + Lus; double Lpb = Lpa + Tw; double Lpc = Lpb + (Bw - Tw); double Lpd = Lpc + Ls; double Lpe = Lpd + (0.5 * lds); double Lpf = Lpd + lds; double valueofsfwb = SF / (wb - 1); double Tas = valueofh() * (1 - (Lpa / Lc)) * valueofsfwb; double Tbs = valueofh() * (1 - (Lpb / Lc)) * valueofsfwb; double Tcs = valueofh() * (1 - (Lpc / Lc)) * valueofsfwb; double Tds = valueofh() * (1 - (Lpd / Lc)) * valueofsfwb; double Tes = valueofh() * (1 - (Lpe / Lc)) * valueofsfwb; double Tfs = valueofh() * (1 - (Lpf / Lc)) * valueofsfwb; //Blieh approace Tad = Hdyn * (1 - (Lpa / Lc)) * valueofsfwb; Tbd = Hdyn * (1 - (Lpb / Lc)) * valueofsfwb; Tcd = Hdyn * (1 - (Lpc / Lc)) * valueofsfwb; Tdd = Hdyn * (1 - (Lpd / Lc)) * valueofsfwb; Ted = Hdyn * (1 - (Lpe / Lc)) * valueofsfwb; Tfd = Hdyn * (1 - (Lpf / Lc)) * valueofsfwb; //KOHSLAS APPROACH FOR FINDING HRC1 AND HRE2............................................ double bH = Lus + Bw + Ls + lds; double xbh = bH / DsCd; double lamda1 = 1 + (Math.Pow(xbh, 2)); double lamdadegre = (1 + (Math.Sqrt(lamda1))) / 2; double lamdavalue = (lamdadegre - 2) / lamdadegre; double tetaE = (1 / Math.PI) * (Math.Acos(lamdavalue)); double lamdavalue2 = (lamdadegre - 1) / lamdadegre; double tetaD = (1 / Math.PI) * (Math.Acos(lamdavalue2)); double tetaD1 = 1 - tetaD; double tetaC1 = 1 - tetaE; double Cdu = tetaC1 + ((tetaD1 - tetaC1) / DsCd) * 0.5; double Cmd = 19 * (Math.Sqrt(DsCd / bH)) * ((UsCd + DsCd) / bH); double Cfu = Cmd + Cdu; double Cdd = tetaE - ((tetaE - tetaD) / DsCd) * 0.5; double Cmu = 19 * (Math.Sqrt(UsCd / bH)) * ((UsCd + DsCd) / bH); double Cfd = Cdd - Cmu; double Hrc1 = valueofh() * Cfu; double Hre2 = valueofh() * Cfd; // KOHSLAS THICKNESS AT VARIOUS POINTS (a,b,c,d,e,f)................................................................... double Lak = Lpa - (2 * UsCd); double Lbk = Lpb - (2 * UsCd); double Lck = Lpc - (2 * UsCd); double Ldk = Lpd - (2 * UsCd); double Lek = Lpe - (2 * UsCd); double Lfk = Lpf - (2 * UsCd); double HR = (Hrc1 - Hre2) / bH; double Pa = Hrc1 - (HR * Lak); double Pb = Hrc1 - (HR * Lbk); double Pc = Hrc1 - (HR * Lck); double Pd = Hrc1 - (HR * Ldk); double Pe = Hrc1 - (HR * Lek); double Pf = Hrc1 - (HR * Lfk); //khoslat Tak = (Pa / (wb - 1)) * 1.3; if (Tak < 0.5) { Tak = 0.5; } Tbk = (Pb / (wb - 1)) * 1.3; Tck = (Pc / (wb - 1)) * 1.3; Tdk = (Pd / (wb - 1)) * 1.3; Tek = (Pe / (wb - 1)) * 1.3; Tfk = (Pf / (wb - 1)) * 1.3; // CODE FOR FINDING THE VALUE OF THICKNESS OF A FLOOR AT A POINT A,B,C,D,E,F //END FOR FINDING THE VALUE OF THICKNESS OF A,B,C,D,E,F //CODE PART FOR LENGTH OF D/S LOOSE TALLUS L3 AND L4.......................................................... double sqrhmaxnq = ((H / 10) * (q / 75)); double L3 = 18 * c * (Math.Sqrt(Math.Abs(sqrhmaxnq))) - ldsa; double L4 = L3 / 2; if (L3 < 0) { lengthofupstreamradTextBox12.Text = "YOU DO NOT ALLOW TO USE LOOSE TALLUS"; lengthofdownstreamradTextBox13.Text = "YOU DO NOT ALLOW TO USE LOOSE TALLUS"; } else { lengthofupstreamradTextBox12.Text = L3.ToString(); lengthofdownstreamradTextBox13.Text = L4.ToString(); } //END COD FOR lENGTH OF UPSTREAM AND DOWN STREAM LOSSE TALLUS (L3 AND L4)........................................ }//END FOR RAND BUTTON METHOD