csharp:FlowLayoutPanel
/// <summary>
/// 集合添加的控件
/// 涂聚文20150339
/// </summary>
public void AddNewTextBox()
{
Point p = new Point(); Label lb1 = new Label();
this.Controls.Add(lb1);
lb1.Text = "关系名称";
lb1.Top = cLeft * 25;
lb1.RightToLeft = RightToLeft.Yes;
cLeft = cLeft + 1;
flowLayoutPanel1.Controls.Add(lb1); System.Windows.Forms.ComboBox cmb = new ComboBox();
relationshipTypeViewTitile.SetCombox(cmb);
this.Controls.Add(cmb);
cmb.Top = cLeft * 25;
cmb.Size = new System.Drawing.Size(121, 20);
cmb.Left = 2;
flowLayoutPanel1.Controls.Add(cmb); Label lb2 = new Label();
this.Controls.Add(lb2);
lb2.Text = "关系人姓名";
lb2.Top = cLeft * 25;
lb2.RightToLeft = RightToLeft.Yes;
cLeft = cLeft + 1;
flowLayoutPanel1.Controls.Add(lb2); System.Windows.Forms.TextBox txtName = new System.Windows.Forms.TextBox();
this.Controls.Add(txtName);
txtName.Name = "txtName";
txtName.Top = cLeft * 25;
txtName.Left = 200;
txtName.Text = "";// "TextBox" + this.cLeft.ToString();
cLeft = cLeft + 1;
flowLayoutPanel1.Controls.Add(txtName); Label lbtel = new Label();
this.Controls.Add(lbtel);
lbtel.Text = "关系人电话";
lbtel.Top = cLeft * 25;
lbtel.RightToLeft = RightToLeft.Yes;
lbtel.Left = 200;
cLeft = cLeft + 1;
flowLayoutPanel1.Controls.Add(lbtel); System.Windows.Forms.TextBox txtTel = new System.Windows.Forms.TextBox();
this.Controls.Add(txtTel);
txtTel.Name = "txtTel";
txtTel.Top = cLeft * 25;
txtTel.Left = 200;
txtTel.Text = "";// "TextBox" + this.cLeft.ToString();
cLeft = cLeft + 1;
flowLayoutPanel1.Controls.Add(txtTel); Label lb4 = new Label();
this.Controls.Add(lb4);
lb4.Text = "关系人生出日期";
lb4.RightToLeft = RightToLeft.Yes;
lb4.Top = cLeft * 25;
cLeft = cLeft + 1;
flowLayoutPanel1.Controls.Add(lb4); System.Windows.Forms.DateTimePicker dtime = new System.Windows.Forms.DateTimePicker();
dtime.Size = new Size(155, 30);
this.Controls.Add(dtime);
cLeft = cLeft + 1;
flowLayoutPanel1.Controls.Add(dtime); Label lb5 = new Label();
this.Controls.Add(lb5);
lb5.Text = "关系人描述";
lb5.Top = cLeft * 25;
lb5.RightToLeft = RightToLeft.Yes;
cLeft = cLeft + 1;
flowLayoutPanel1.Controls.Add(lb5); System.Windows.Forms.TextBox txtRelationDesc = new System.Windows.Forms.TextBox();
this.Controls.Add(txtRelationDesc);
txtRelationDesc.Name = "txtRelationDesc";
txtRelationDesc.Top = cLeft * 25;
txtRelationDesc.Left = 200;
txtRelationDesc.Text = "";// "TextBox" + this.cLeft.ToString();
cLeft = cLeft + 1;
flowLayoutPanel1.Controls.Add(txtRelationDesc); } /// <summary>
/// 添加控件事件
/// 涂聚文20150339
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
AddNewTextBox();
}
/// <summary>
/// 获取添的控件的值
/// 涂聚文20150339
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{
int s = 0;
int k = 0;
int n = 0; for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++)
{ if (flowLayoutPanel1.Controls[i].GetType() == typeof(ComboBox)) //按类型查找
{ customerRelationTypeID = ((ComboBox)this.flowLayoutPanel1.Controls[i]).SelectedValue.ToString();
}
if (flowLayoutPanel1.Controls[i].GetType() == typeof(TextBox))
{
//MessageBox.Show(((TextBox)this.flowLayoutPanel1.Controls[i]).Name); if (((TextBox)this.flowLayoutPanel1.Controls[i]).Name.Contains("txtName"))
{
customerRelationName = ((TextBox)this.flowLayoutPanel1.Controls[i]).Text.Trim();
}
if (((TextBox)this.flowLayoutPanel1.Controls[i]).Name.Contains("txtTel"))
{
customerRelationTel = ((TextBox)this.flowLayoutPanel1.Controls[i]).Text.Trim();
}
if (((TextBox)this.flowLayoutPanel1.Controls[i]).Name.Contains("txtRelationDesc"))
{
customerRelationDesc = ((TextBox)this.flowLayoutPanel1.Controls[i]).Text.Trim();
}
} if (flowLayoutPanel1.Controls[i].GetType() == typeof(DateTimePicker)) //按类型查找
{ customerBirthday = ((DateTimePicker)this.flowLayoutPanel1.Controls[i]).Value;
} if (IsOdd5(i))
{ customerRelationContactsId = CustomerRelationContactsId; if (Operator == 1)
{ customerRelationshipListInfo.CustomerBirthday = customerBirthday;
customerRelationshipListInfo.CustomerRelationContactsId = customerRelationContactsId;
customerRelationshipListInfo.CustomerRelationDesc = customerRelationDesc;
customerRelationshipListInfo.CustomerRelationName = customerRelationName;
customerRelationshipListInfo.CustomerRelationTel = customerRelationTel;
customerRelationshipListInfo.CustomerRelationTypeID = customerRelationTypeID;
k = customerRelationshipListBLL.InsertCustomerRelationshipList(customerRelationshipListInfo); //MessageBox.Show(customerRelationTypeID + customerRelationName + customerRelationTel);
n++; } } }
if (n > 0)
{
DialogResult dresult = MessageBox.Show("添加了" + n.ToString() + "条联系人", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
if (dresult == DialogResult.OK)
{
this.Close();
this.DialogResult = DialogResult.OK;
}
}
else
{
DialogResult dresult = MessageBox.Show("存在问题,添加了" + n.ToString() + "条联系人", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
if (dresult == DialogResult.No)
{
this.Close();
this.DialogResult = DialogResult.OK;
}
if (dresult == DialogResult.Yes)
{
return;
}
} } /// <summary>
/// 判断奇偶数的函數
/// </summary>
/// <param name="n"></param>
/// <returns></returns>
public static bool IsOdd2(int n)
{
return Convert.ToBoolean(n % 2);
}
/// <summary>
///
/// </summary>
/// <param name="n"></param>
/// <returns></returns>
public static bool IsOdd5(int n)
{
int b = 0;
bool isb = false;
b = n % 9;
if (n > 0)
{
if (b == 0)
{
isb = true;
}
}
return isb;
}
csharp:FlowLayoutPanel的更多相关文章
- c#操作MangoDB 之MangoDB CSharp Driver驱动详解
序言 MangoDB CSharp Driver是c#操作mongodb的官方驱动. 官方Api文档:http://api.mongodb.org/csharp/2.2/html/R_Project_ ...
- c#进阶之神奇的CSharp
CSharp 简写为c#,是一门非常年轻而又有活力的语言. CSharp的诞生 在2000年6月微软发布了c#这门新的语言.作为微软公司.NET 平台的主角,c#吸收了在他之前诞生的语言(c ...
- FlowLayoutPanel
动态生成控件 按顺序规律排列时 用panel的话 要指定特定的位置 .麻烦. 可以通过用flowLayoutPanel来解决. FlowLayoutPanel:表格布局面板,适合以表格形式规则的动态 ...
- WindowsCE project missing Microsoft.CompactFramework.CSharp.targets in Visual Studio 2008
00x0 前言 之前在Windows 7系统中开发的WindowsCE项目,最近换成Windows 10系统,需要将项目进行修改,打开项目后提示如下错误: 无法读取项目文件"App.cspr ...
- csharp: Oracle Stored Procedure DAL using ODP.NET
paging : http://www.codeproject.com/Articles/44858/Custom-Paging-GridView-in-ASP-NET-Oracle https:// ...
- Excel转Json,Json转CSharp
一份给策划最好的礼物!就是:Excel2Json2CSharp 策划配置Excel,动不动就要改数值啊,增加字段啊. 程序这边对应的解析类就得改动啊.整一个麻烦了得! 所以我就整理了这个Excel2J ...
- Microsoft.CompactFramework.CSharp.targets not found
今天打开VS2008的智能设备项目,报以下错误,应该是文件找不到了. The imported project "C:\WINDOWS\Microsoft.NET\Framework\v3. ...
- CSharp 相关知识点小结
1.JS获取iframe下面的内容document.getElementById('IFRAME1').contentDocument; 2.dialog 弹出层,定位:postion:'bottom ...
- 自己动手制作CSharp编译器
在你喜欢的位置(如F盘根目录)新建一个文件夹,并命名为“CSharp开发环境”.找到或下载C#编译器组件(csc.exe和cscui.exe),并放在先前建立的文件夹中.该组件的一般位置在C盘的.NE ...
随机推荐
- (二)Python 装饰器
1. 函数 在 Python 中,使用关键字 def 和一个函数名以及一个可选的参数列表来定义函数.函数使用 return 关键字来返回值.定义和使用一个最简单的函数例子: >>> ...
- 本机号码认证黑科技:极光(JG)开发者服务推出“极光认证”新产品
近日,中国领先的大数据服务商极光(JG)推出全新产品--极光认证JVerification.极光认证是极光针对APP用户注册登陆,二次安全验证等身份验证场景打造的一款本机号码认证SDK,验证用户提供的 ...
- numpy 常用方法2
Python之Numpy基础 一个栗子 >>> import numpy as np >>> a = np.arange(15).reshape(3, 5) & ...
- Asp.net的生命周期之页生命周期
参考:http://msdn.microsoft.com/zh-cn/library/ms178472%28v=vs.100%29.aspx http://msdn.microsoft.com/zh- ...
- eclipse如何设置UTF-8
一.Eclipse设置utf-8编码包括两个方面,一方面可以设置workspace工作间编码,另一方面可以设置Android Project项目编码,设置步骤: 1)设置workspace工作间编码: ...
- 常见的http错误提示
1xx(临时响应)表示临时响应并需要请求者继续执行操作的状态代码. 代码 说明100 (继续) 请求者应当继续提出请求.服务器返回此代码表示已收到请求的第一部分,正在等待其余部分. 101 (切换协议 ...
- ArcGis10.2破解教程
ArcGis10.2下载地址: https://pan.baidu.com/s/15s5ki_8gf0_732br6h43Hw 破解步骤: 1.完成License Manager的安装. 2.将破解文 ...
- Cinderella
Chapter 1 Ella, Ella, CinderellaThere is a beauiful girl. Her name is Ella.She lives with a wicked s ...
- .Net Core 发布异常 An assembly specified in the application
在Core 2.0站点发布时.. DotNet WW.kkkk.dll 报错..报文内容如下: Error: An assembly specified in the application depe ...
- @using (Html.BeginForm())和@{Html.BeginForm();}@{Html.EndForm();}对比
这样写报错 <body> @using (Html.BeginForm()) { form主体1 } @{Html.BeginForm();} ...