473,386 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Align text and set usesystempasswordchar= true in run time

Hello,
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
  1. Private Sub tbxLogin_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles tbxLogin.LostFocus
  2.  
  3.         If tbxLogin.Text = String.Empty Then
  4.             'tbxLogin.ResetText()
  5.             tbxLogin.ForeColor = Color.Gray
  6.             'tbxLogin.TextAlign = HorizontalAlignment.Center    'trying to align the tbx gives it focus 
  7.             tbxLogin.Text = "User Name Or Mobile NO"
  8.             login = False
  9.         Else
  10.             pwd = True
  11.         End If
  12.     End Sub
  13.  
  14.     Private Sub tbxLogin_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles tbxLogin.GotFocus
  15.         If tbxLogin.Text = "User Name Or Mobile NO" Then
  16.             tbxLogin.Text = String.Empty
  17.             tbxLogin.TextAlign = HorizontalAlignment.Left  'conflict with the two alingments
  18.             tbxLogin.ForeColor = Color.Black
  19.         Else
  20.             tbxLogin.SelectAll()
  21.         End If
  22.     End Sub
  23.  
And the code for setting pwd char is
Expand|Select|Wrap|Line Numbers
  1. Private Sub tbxPwd_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles tbxPwd.GotFocus
  2.         If tbxPwd.Text = "Password" Then
  3.             tbxPwd.Clear()
  4.             tbxPwd.UseSystemPasswordChar = True
  5.             tbxPwd.TextAlign = HorizontalAlignment.Left
  6.             tbxPwd.ForeColor = Color.Black
  7.         Else
  8.             tbxPwd.SelectAll()
  9.         End If
  10.     End Sub
  11.  
  12.  Private Sub tbxPwd_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles tbxPwd.LostFocus
  13.         If tbxPwd.Text = String.Empty Then
  14.             tbxPwd.ForeColor = Color.Gray
  15.             'tbxPwd.TextAlign = HorizontalAlignment.Center     'problem line if enabled
  16.             tbxPwd.Text = "Password"
  17.             'tbxPwd.UseSystemPasswordChar = False  'problem line if enabled
  18.         Else
  19.             pwd = True
  20.         End If
  21.     End Sub
  22.  
The project is included in the zip file.
Attached Files
File Type: zip SMS.zip (143.4 KB, 83 views)
Dec 31 '11 #1
1 2874
The problem is that all these commands are triggering lost and got focus in an endless loop.
Jan 4 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Abhijeet Kumar | last post by:
Hi How can i justify align text on Label Control. I am working in C# Desktop application
4
by: M Shafaat | last post by:
Hi! How can I make label, linklabel . controls to accept multilined text at design time and in the properties window of Visual Studio? Regards M Shafaat
2
by: Kay | last post by:
Hello, I have a asp lable control, which I use to display text in, I would like to have the text display aligned in the center and vertical alignment left however when I add the following style...
4
by: acko bogicevic | last post by:
Hi How can I align text in textbox to right, left or center Thanks alex *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
6
by: DM | last post by:
Is there any way to left align the text in a server control button?
2
by: Tom McL. | last post by:
I would like to align text in a ListBox to achieve columns. In the past I could determine the text width in Twips and pad in required number of blank spaces. But now I'm using VB2005 and it...
3
by: ad | last post by:
I have set a TextBox to MultiLines and set the rows to 10. I assigned the Text of the TextBox some lins of text at desgin time, but only the first line remain in the TextBox. How can I assign...
0
by: JR123 | last post by:
Hi I am creating a form - the section below is if the person selects flight from the drop down list another field below drops down so they can enter flight details. how can i align the flight...
3
by: ashraf02 | last post by:
hi i am trying to align text .... wel links to other pages on my website but i cant seem to get it in line with my table. the table falls below the navigation links i have created. Thanks for...
6
by: acorna | last post by:
Hi All This may seem like a stupid question but I can't get my text to left align. It used to but it's now decided to centre and I can't see why. I have include the css and the relevant table...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.