/// <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的更多相关文章

  1. c#操作MangoDB 之MangoDB CSharp Driver驱动详解

    序言 MangoDB CSharp Driver是c#操作mongodb的官方驱动. 官方Api文档:http://api.mongodb.org/csharp/2.2/html/R_Project_ ...

  2. c#进阶之神奇的CSharp

    CSharp 简写为c#,是一门非常年轻而又有活力的语言. CSharp的诞生      在2000年6月微软发布了c#这门新的语言.作为微软公司.NET 平台的主角,c#吸收了在他之前诞生的语言(c ...

  3. FlowLayoutPanel

    动态生成控件  按顺序规律排列时 用panel的话 要指定特定的位置 .麻烦. 可以通过用flowLayoutPanel来解决. FlowLayoutPanel:表格布局面板,适合以表格形式规则的动态 ...

  4. WindowsCE project missing Microsoft.CompactFramework.CSharp.targets in Visual Studio 2008

    00x0 前言 之前在Windows 7系统中开发的WindowsCE项目,最近换成Windows 10系统,需要将项目进行修改,打开项目后提示如下错误: 无法读取项目文件"App.cspr ...

  5. csharp: Oracle Stored Procedure DAL using ODP.NET

    paging : http://www.codeproject.com/Articles/44858/Custom-Paging-GridView-in-ASP-NET-Oracle https:// ...

  6. Excel转Json,Json转CSharp

    一份给策划最好的礼物!就是:Excel2Json2CSharp 策划配置Excel,动不动就要改数值啊,增加字段啊. 程序这边对应的解析类就得改动啊.整一个麻烦了得! 所以我就整理了这个Excel2J ...

  7. Microsoft.CompactFramework.CSharp.targets not found

    今天打开VS2008的智能设备项目,报以下错误,应该是文件找不到了. The imported project "C:\WINDOWS\Microsoft.NET\Framework\v3. ...

  8. CSharp 相关知识点小结

    1.JS获取iframe下面的内容document.getElementById('IFRAME1').contentDocument; 2.dialog 弹出层,定位:postion:'bottom ...

  9. 自己动手制作CSharp编译器

    在你喜欢的位置(如F盘根目录)新建一个文件夹,并命名为“CSharp开发环境”.找到或下载C#编译器组件(csc.exe和cscui.exe),并放在先前建立的文件夹中.该组件的一般位置在C盘的.NE ...

随机推荐

  1. Jmeter中一些概念的理解——90%响应时间、事务、并发

    一.90%响应时间(参考虫师博客) 90%Line  一组数由小到大进行排列,找到他的第90%个数(假如是12),那么这个数组中有90%的数将小于等于12 . 用在性能测试的响应时间,也就是90%请求 ...

  2. SaltStack 基础

    介 SaltStack是基于Python开发的一套C/S架构配置管理工具.它的底层使用ZeroMQ消息队列pub/sub方式通信,使用SSL证书签发的方式进行认证管理.号称世界上最快的消息队列Zero ...

  3. 如何使用robots禁止各大搜索引擎爬虫爬取网站

    ps:由于公司网站配置的测试环境被百度爬虫抓取,干扰了线上正常环境的使用,刚好看到每次搜索淘宝时,都会有一句由于robots.txt文件存在限制指令无法提供内容描述,于是便去学习了一波 1.原来一般来 ...

  4. 基于XMPP的即时通信系统的建立 — XMPP IQ详解

    XMPP详解 XMPP(eXtensible Messaging and Presence Protocol,可扩展消息处理和现场协议)是一种在两个地点间传递小型结构化数据的协议.在此基础上,XMPP ...

  5. QuantLib 金融计算——随机过程之概述

    目录 QuantLib 金融计算--随机过程之概述 框架 用法与接口 如果未做特别说明,文中的程序都是 Python3 代码. QuantLib 金融计算--随机过程之概述 载入模块 import Q ...

  6. TX2 i2c-tools使用

    安装: apt-get install libi2c-dev i2c-tools 检测i2c总线数目 用i2cdetect检测有几组i2c总线在系统上: i2cdetect -l 可以看到系统中有9组 ...

  7. JS实现表格列宽拖动

    在数据表格中,有时候需要拖动表格宽度,查看完整的数据,是很常用的功能. 1 效果 可以用纯JS就可以实现,如下,是正常情况下的表格: 拖动表格标题中间线,拖动后效果如下: 查看DEMO 2 代码 HT ...

  8. python全栈开发_day16_包

    一:包 1)包就是管理一系列模块的文件夹 2)包中有一个__init__.py文件来专门管理每一个模块(在__init__文件中不建议import导入模块,不建议as起别名) 二:导入完成的工作 1) ...

  9. 初识Flask框架,以及Flask中的模板语言jinjia2和Flask内置的Session

    一.web框架的对比 首先我们先来看下比较火的web框架 1.Django: 优点:大而全,所有组件都是组织内部开发高度定制化,教科书级别的框架 缺点:大到浪费资源,请求的时候需要的资源较高 2.Fl ...

  10. shell (三) 文件压缩

    查看压缩文件 #tar tvf tar.tar.gz -rw-r--r-- root/root 290 2019-03-22 14:38 README.md -rw-r--r-- root/root ...