private void btnFromAdd_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(cmbJobType.Text)) { ExceptionMsgBox.This.ShowMessageBox(MessageType.Warning, "Select JobType", this.Text); return; } //if (String.IsNullOrEmpty(cmbFromPort.Text) || String.IsNullOrEmpty(cmbFromCST.Text)) if (String.IsNullOrEmpty(cmbFromPort.Text)) { ExceptionMsgBox.This.ShowMessageBox(MessageType.Warning, "Select Port", this.Text); return; } if( String.IsNullOrEmpty(txtFromCST.Text)) { ExceptionMsgBox.This.ShowMessageBox(MessageType.Warning, "Check Carrier", this.Text); return; } if (this.duplicateCheckCST(txtFromCST.Text)) { return; } //Split or Scrap or SlotChange ,only select one CST if ( (string.Equals(cmbJobType.Text,SortJobType.Split) || string.Equals(cmbJobType.Text,SortJobType.Scrap)|| string.Equals(cmbJobType.Text,SortJobType.SlotChange)) && tabControl1.TabCount >= 1) { ExceptionMsgBox.This.ShowMessageBox(MessageType.Warning, "SortJobType is " + cmbJobType.Text + ", Source CST only choice One!", this.Text); return; } //string grdtitle = "grdFrom" + cmbFromCST.Text; string grdtitle = "grdFrom" + txtFromCST.Text; TabPage tab = new TabPage(); //tab.Text = this.cmbFromPort.Text + "_" + this.cmbFromCST.Text; tab.Text = cmbFromPort.Text; //tab.Name = "tp" + cmbFromCST.Text; tab.Name = "tp" + txtFromCST.Text; //this.createDesignInstance(tab, grdtitle, cmbFromCST.Text); this.createDesignInstance(tab, grdtitle, txtFromCST.Text); this.tabControl1.TabPages.Add(tab); try { UGrid grdFrom = new UGrid(); Control[] ctrl = this.tabControl1.TabPages[tabControl1.TabCount - 1].Controls.Find(grdtitle, true); if (ctrl.Length > 0) { grdFrom = ctrl[0] as UGrid; } this.tabControl1.SelectTab(tabControl1.TabCount - 1); // zendao 490 setDummyGlassRowHighLight 20210830 foreach (TabPage page in tabControl1.TabPages) { foreach (Control tabPanel in page.Controls) { foreach (Control grid in tabPanel.Controls) { if (grid is UGrid) { UGrid grdProductList = new UGrid(); grdProductList = (UGrid)grid; setDummyGlassRowHighLight(grdProductList); setEmptyGlassActivation(grdProductList); grdProductList.SetPerformAutoResize(); } } } } } catch (Exception err) { UILogger.This.Trace(err); } }
时间: 2024-04-07 15:31:53 浏览: 20
这段代码是用来处理一个按钮的点击事件,当点击这个按钮时,会执行一系列的判断和操作,最终会创建一个新的选项卡,并在其中添加一个名为“grdFrom”的控件。其中,代码中包含了一些条件判断,例如如果“cmbJobType”控件中的文本为空,则会弹出一个警告框提示用户选择“JobType”;如果“cmbFromPort”控件中的文本为空,则会弹出一个警告框提示用户选择“Port”等。此外,代码中还包含了一些异常处理的代码,例如当查找所需的控件失败时,会输出异常信息。
相关问题
加英文注释 private void Button_ok(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(Height.Text)&& string.IsNullOrEmpty(width.Text)) { } else { q = Convert.ToInt32(Height.Text); p = Convert.ToInt32(width.Text); Thickness1(); } }
Here's the annotated code with English comments:
```csharp
private void Button_ok(object sender, RoutedEventArgs e)
{
// Check if the Height and Width text boxes are empty or null
if (string.IsNullOrEmpty(Height.Text) && string.IsNullOrEmpty(width.Text))
{
// If both are empty, do nothing
}
else
{
// If at least one text box has a value, convert the text to integers
q = Convert.ToInt32(Height.Text);
p = Convert.ToInt32(width.Text);
// Call the method Thickness1() to perform some calculations
Thickness1();
}
}
```
This code is a method that handles a button click event. It checks if the Height and Width text boxes are empty or null, and if not, converts their values to integers. Then it calls another method called Thickness1() to perform some calculations.
private void Findpwd_Click(object sender, EventArgs e) { }请完善此代码实现网页跳转
### 回答1:
可以将这段代码改写为:private void Findpwd_Click(object sender, EventArgs e) { Response.Redirect("/pwd.aspx"); }
### 回答2:
要实现网页跳转,可以使用Response.Redirect方法。在给定的代码中,可以在Findpwd_Click方法中添加以下代码实现网页跳转:
```
private void Findpwd_Click(object sender, EventArgs e)
{
// 在这里添加你要跳转的网页地址
string url = "http://www.example.com";
// 使用Response.Redirect方法进行网页跳转
Response.Redirect(url);
}
```
上述代码中,我们首先将要跳转的网页地址赋给变量url。然后使用Response.Redirect方法,将url作为参数传递给该方法,即可实现网页跳转。
注意:在实际使用中,需要根据具体需求修改网页地址,将"http://www.example.com"替换为你要跳转的网页的URL。
### 回答3:
要实现网页跳转,可以使用Response.Redirect方法。完善代码如下:
private void Findpwd_Click(object sender, EventArgs e)
{
// 在此添加你要跳转的网页链接
string url = "http://www.example.com";
// 调用Response.Redirect方法进行跳转
Response.Redirect(url);
}
相关推荐
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)