/// <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. HTML5基础实例(三)

    不知道从哪说起那就一段一段代码的说吧 实例一:iframe框架显示 写一个这样的网页: 分析: 1.需要三个链接,一个是默认的百度链接,默认显示在那个框里,另外:两个是点击跳转的超链接. 2.需要if ...

  2. C语言实现单链表,并完成链表常用API函数

    C语言实现单链表,并完成链表常用API函数: 1.链表增.删.改.查. 2.打印链表.反转打印.打印环形链表. 3.链表排序.链表冒泡排序.链表快速排序. 4.求链表节点个数(普通方法.递归方法). ...

  3. Java_日志接口实现

    日志的接口实现:改用slf4j实现日志功能 为什么要使用slf4j,而不是用log4j或者其他日志框架? 因为slf4j只是规定了一堆实现了日志的接口,并不关心日志怎么实现,这样就可以让项目脱离对日志 ...

  4. mysql的left join、 right join和inner join

    1.定义 left join:左联接,返回包括左表中的所有记录和右表中符合条件的记录. right join:右联接,返回包括右表中的所有记录和左表中符合条件的记录. inner join:等值联接, ...

  5. 小M的作物 最小割最大流

    题目描述 小M在MC里开辟了两块巨大的耕地A和B(你可以认为容量是无穷),现在,小P有n中作物的种子,每种作物的种子有1个(就是可以种一棵作物)(用1...n编号). 现在,第i种作物种植在A中种植可 ...

  6. jQuery 属性操作attr().prop().text().html().val()

    这些方法用于获取和设置 DOM 元素的属性. 一.attr(): <!--样式:在style里面写的,用css来操作.--> <!--属性:在元素里面写的,用attr方法操作.--& ...

  7. 彻底理解JDK异步

    学而时习之,不亦说乎!                              --<论语> 首发,转载请附原文链接,谢谢. 原文使用MD格式编写,复制进来代码缩成一团了,读者见谅,需要 ...

  8. 豆瓣电影信息爬取(json)

    豆瓣电影信息爬取(json) # a = "hello world" # 字符串数据类型# b = {"name":"python"} # ...

  9. "[Vue warn]: Failed to mount component: template or render function not defined"错误的解决

    VUE中动态路由出错: vue.esm.js?a026: [Vue warn]: Failed to mount component: template or render function not ...

  10. 2019.04.18 第六次训练 【2018-2019 ACM-ICPC, NEERC, Southern Subregional Contest, Qualification Stage】

    题目链接: https://codeforces.com/gym/101911 又补了set的一个知识点,erase(it)之后it这个地址就不存在了,再引用的话就会RE A: ✅ B:  ✅ C: ...