VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Better coding Tips for beginners.

by Anitha (5 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 10th February 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Better coding Tips for beginners.

Rate Better coding Tips for beginners.




'(1) Tips for better coding

'The user may enter values either in upper case or lower case,
'but it is always better to store them uniformly in the database,
'so that the reports produced later will have a clear look

'To convert to uppercase
Text1.Text = Format(Text1.Text, ">") 'Example: aNitHa converted as ANITHA

'To convert to lowercase
Text1.Text = Format(Text1.Text, "<") 'Example: aNitHa converted as anitha


'(2) Tips for better coding

'By setting tab index, the user can switch
'between the controls using the tab key.
Text1.TabIndex = 0
Command1.TabIndex = 1
Combo1.TabIndex = 2

'(3) Tips for better coding

Combo1.AddItem ("I00001" & "  -->  " & "Rice")
Combo1.AddItem ("I00002" & "  -->  " & "Sugar")
Combo1.AddItem ("I00003" & "  -->  " & "Oil")
'This can be implemented using the recordsets also as
'combo1.additem(rs(0) & " -->" & rs(1))
'Any symbol such as " | " or "***" or ">>" can be used as separators in-between

'(4) Tips for better coding

'Apart from a status bar control,the user can be
'guided using the tooptip property.

Combo1.ToolTipText = "Can select multiple options !"
Command1.ToolTipText = "Click to view more details ..."
Text1.ToolTipText = "Enter digits only..."  'or a description about the field would be an apt tooltip !

'(5) Tips for better coding

'There are situations when u wanted to add some
'controls on your MDIform,but the system will say that
'only controls with alignment properties can be added.
'In such situations add a picture control to ur form,
'and stretch the control throughout the form,
'and now add labels,textboxes..whatever u wanted to add !
'But don't forget to make the picture control visibility property to false
'in all the child forms,otherwise ,those forms will be
'hidden under ur picture control.

'(6) Tips for better coding

'While getting date from the users, always use any of the date controls
'such as  Date picker ,Calendar control or a Month view control
'While using them,make them visible only in the click event of a text box as follows.
'In form_load event - make Calendar1.Visible = false
'In text1_gotfocus make Calendar1.Visible = True
'In text1_keypress event,
'make Text1.Text = Calendar1.Value, Calendar1.visible = false

'Try & send ur valuable comments to [email protected]

End Sub



Download this snippet    Add to My Saved Code

Better coding Tips for beginners. Comments

No comments have been posted about Better coding Tips for beginners.. Why not be the first to post a comment about Better coding Tips for beginners..

Post your comment

Subject:
Message:
0/1000 characters