I am a very beginner in VB .net. Came through Technical JunkYard (ubaid.tk) and thought to make sms sending s/w for myself using the API provided on the site.
But I want some customization a/c to me.
But the text alignment and setting password char true @ runtime in case of no input is troubling me.
The code for alignment is
Expand|Select|Wrap|Line Numbers
- Private Sub tbxLogin_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles tbxLogin.LostFocus
- If tbxLogin.Text = String.Empty Then
- 'tbxLogin.ResetText()
- tbxLogin.ForeColor = Color.Gray
- 'tbxLogin.TextAlign = HorizontalAlignment.Center 'trying to align the tbx gives it focus
- tbxLogin.Text = "User Name Or Mobile NO"
- login = False
- Else
- pwd = True
- End If
- End Sub
- Private Sub tbxLogin_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles tbxLogin.GotFocus
- If tbxLogin.Text = "User Name Or Mobile NO" Then
- tbxLogin.Text = String.Empty
- tbxLogin.TextAlign = HorizontalAlignment.Left 'conflict with the two alingments
- tbxLogin.ForeColor = Color.Black
- Else
- tbxLogin.SelectAll()
- End If
- End Sub
Expand|Select|Wrap|Line Numbers
- Private Sub tbxPwd_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles tbxPwd.GotFocus
- If tbxPwd.Text = "Password" Then
- tbxPwd.Clear()
- tbxPwd.UseSystemPasswordChar = True
- tbxPwd.TextAlign = HorizontalAlignment.Left
- tbxPwd.ForeColor = Color.Black
- Else
- tbxPwd.SelectAll()
- End If
- End Sub
- Private Sub tbxPwd_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles tbxPwd.LostFocus
- If tbxPwd.Text = String.Empty Then
- tbxPwd.ForeColor = Color.Gray
- 'tbxPwd.TextAlign = HorizontalAlignment.Center 'problem line if enabled
- tbxPwd.Text = "Password"
- 'tbxPwd.UseSystemPasswordChar = False 'problem line if enabled
- Else
- pwd = True
- End If
- End Sub