标签:style blog color os ar 使用 for sp 文件
定义一个bool类型的变量,默认为FALSE的
1 private bool BHaveBeenTip=false; 2 private void label5_Click(object sender, EventArgs e) 3 { 4 var oFileBrowser = new FileBowser(); 5 if (oFileBrowser.ShowDialog() == DialogResult.OK) 6 { 7 foreach (string fName in oFileBrowser.ListSelectedFile) 8 { 9 this.AddAttachment(fName, false, false); 10 } 11 bHasBeenTips = false; 12 } 13 oFileBrowser.Dispose(); 14 } 15 16 private void AddAttachment(string aFileName, bool aIsDelete, bool aIsLargeAttachment) 17 { 18 if (attachList.Exists(o => o.Equals(aFileName, StringComparison.OrdinalIgnoreCase))) 19 { 20 if (!bHasBeenTips) //此处省略了 if(!bHasBeenTips==true) 21 { 22 MessageBoxEx.ShowBox("不允许上传同名文件.", MessageBoxButtons.OK); 23 bHasBeenTips = true; 24 } 25 return; 26 } 27 else 28 { 29 .................................. 30 } 31 }
标签:style blog color os ar 使用 for sp 文件
原文地址:http://www.cnblogs.com/jingsheng99/p/4045834.html