Hello programmers, I have one problem. I have two Textboxes (GSM and Telefon) with Mask. So I whant, when is one empty (e.g. Telefon, it mean, that I don't put no numbers in this textbox) that is writen on paper only one that is full (e.g. GSM).
Here is code that I use:
Problem is, that Masked Textbox will always be full. If you see in code above GSM and Telefon are fields with length of 15 characters. So if I dont put number in Textbox e.g. Telefon, field will be empty - visualy, in truth there is still 15 characters in. Here is picture:
(This field is from database, Mask Textbox is in other form, where you put number and save it to database).
Thanks to all for any ideas.
Here is code that I use:
Code:
If (GSMTextBox.Text.Length = 15 AndAlso TelefonTextBox.Text.Length = 15) Then
e.Graphics.DrawString(Label19.Text, font1, Brushes.Black, e.MarginBounds.Left, 217)
e.Graphics.DrawString(GSMTextBox.Text, font1, Brushes.Black, 145, 217)
e.Graphics.DrawString(Label20.Text, font1, Brushes.Black, 267, 217)
e.Graphics.DrawString(TelefonTextBox.Text, font1, Brushes.Black, 328, 217)
ElseIf (GSMTextBox.Text.Length = 15 AndAlso TelefonTextBox.Text.Length < 1) Then
e.Graphics.DrawString(Label19.Text, font1, Brushes.Black, e.MarginBounds.Left, 217)
e.Graphics.DrawString(GSMTextBox.Text, font1, Brushes.Black, 145, 217)
e.Graphics.DrawString(Label20.Text, font1, Brushes.White, 267, 217)
e.Graphics.DrawString(TelefonTextBox.Text, font1, Brushes.White, 328, 217)
ElseIf (GSMTextBox.Text.Length < 1 AndAlso TelefonTextBox.Text.Length = 15) Then
e.Graphics.DrawString(Label20.Text, font1, Brushes.Black, e.MarginBounds.Left, 217)
e.Graphics.DrawString(TelefonTextBox.Text, font1, Brushes.Black, 145, 217)
e.Graphics.DrawString(Label19.Text, font1, Brushes.White, 267, 217)
e.Graphics.DrawString(GSMTextBox.Text, font1, Brushes.White, 328, 217)
ElseIf (GSMTextBox.Text.Length < 1 AndAlso TelefonTextBox.Text.Length < 1) Then
e.Graphics.DrawString(Label20.Text, font1, Brushes.White, e.MarginBounds.Left, 217)
e.Graphics.DrawString(TelefonTextBox.Text, font1, Brushes.White, 145, 217)
e.Graphics.DrawString(Label19.Text, font1, Brushes.White, 267, 217)
e.Graphics.DrawString(GSMTextBox.Text, font1, Brushes.White, 328, 217)
End IfThanks to all for any ideas.