Just want to share a couple of discoveries I've just made (for myself) about visual basic.
1. Did you know that you don't need to specify that boring
in the event handlers any more if you don't need the sender part.Code:sender As System.Object, e As System.EventArgs
I just wrote
vb Code:
Private Sub Form1_Load() Handles Me.Load MessageBox.Show("test") End Sub
and it was compiled without. Imagine that!
2. What I missed the most is the true conditional operator (like the one in my signature). IIf was a poor substitution since it is really a function, not a ternary operator and it evaluated all its arguments which defeated the initial purpose of this language construction. To my amazement, I only just discovered the If operator which happens to be just that - a ternary operator. So, you can simply do this:
vb Code:
TextBox1.Text = If(IsDbNull(value), "", value.ToString())
Perhaps I didn't tell anything new to someone, but I'm sure, there are people who might find this information useful.




Reply With Quote