Advertisement
Lauda

Untitled

May 16th, 2014
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.48 KB | None | 0 0
  1.         private void btnTip_Click(object sender, EventArgs e)
  2.         {
  3.             using (var form = new frmTipVrste(true))
  4.             {
  5.                 var result = form.ShowDialog();
  6.                 if (result == DialogResult.OK)
  7.                 {
  8.                     string tvID = form.tvID;
  9.                     Image img = form.tvImg;
  10.  
  11.  
  12.                     this.txtTip.Text = tvID;
  13.                     this.pictureBox1.Image = img;
  14.  
  15.                     if (img == null)
  16.                     {
  17.                         btnIcon.Enabled = true;
  18.                     }
  19.  
  20.                     if (String.IsNullOrEmpty(tvID))
  21.                     {
  22.                         epHandler.SetError(txtTip, "Error: Odaberite validan tip!");
  23.                         validTip = false;
  24.                     }
  25.                     else
  26.                     {
  27.                         epHandler.SetError(txtOznaka, "");
  28.                         validTip = true;
  29.                     }
  30.                 }
  31.             }
  32.         }
  33.  
  34.  
  35. // U formi od tipa:
  36.         private bool izbor = false;
  37.         public string tvID {get; set;}
  38.         public Image tvImg {get; set;}
  39.  
  40.         public frmTipVrste(Boolean izbor)
  41.         {
  42.             InitializeComponent();
  43.             this.izbor = izbor;
  44.         }
  45.  
  46. // u selectionChanged od tabele:
  47.             if (this.izbor)
  48.             {
  49.                 this.tvID = tv.oznaka + " | " + tv.ime;
  50.                 this.tvImg = tv.ikonica;
  51.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement