/// <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. app.module.ts说明

    import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; ...

  2. Tomcat和Mysql部署成Windows服务

    如题: Tomcat部署进入到Tomcat的bin目录,执行命令:service.bat install  [service_name]安装完毕后服务中能看见Apache Tomcat 7.0 [se ...

  3. docker 限制 容器内存 使用

    转载 : https://www.cnblogs.com/sparkdev/p/8032330.html 默认情况下容器使用的资源是不受限制的.也就是可以使用主机内核调度器所允许的最大资源.但是在容器 ...

  4. Python数据结构之序列及其操作

    数据结构是计算机存储,组织数据的方式.数据结构是指相互之间存在一种或多种特定关系的数据元素的集合. 在Python中,最基本的数据结构为序列(sequence).序列中的每个元素都有编号:从0开始递增 ...

  5. 洛谷 P3757 [CQOI2017]老C的键盘

    题面 luogu 题解 其实就是一颗二叉树 我们假设左儿子小于根,右儿子大于根 考虑树形\(dp\) \(f[u][i]\)表示以\(u\)为根的子树,\(u\)为第\(i\)小 那么考虑子树合并 其 ...

  6. Docker for Windows 启动失败,提示Kubernetes证书无效

    起因 部署服务器到一台很久未更新的系统(windows 10),安装docker后,恰好系统自动更新,重启后docker不能启动,提示Kubernetes证书无效(未截到图,抱歉) 排查 因为没有开启 ...

  7. C# 委托进阶

    本文参考自:https://wenku.baidu.com/view/41ab91d3c1c708a1284a44d7.html?qq-pf-to=pcqq.c2c 1.为什么委托定义的返回值通常为v ...

  8. maevn HelloWorld 基本命令

    总结: Mvn clean compile:编译主代码 Mvn clean test:执行测试代码 Mvn clean package:打包 Mvn clean install: 安装到本地仓库 执行 ...

  9. 002javascript变量&数据类型

    •变量 –JavaScript 是一种弱类型的脚本语言 –var c = 3:即变量的声明(变量使用之前必须加var声明,编程规范) –变量的命名规则! •1.变量命名必须以字母或是下标符号”_”或者 ...

  10. 【分步详解】两个有序数组中的中位数和Top K问题

    (这也是一道leetcode的经典题目:<LeetCode>解题笔记:004. Median of Two Sorted Arrays[H] 问题介绍 这是个超级超级经典的分治算法!!这个 ...