How to Capitalize the First Letter on a Text Box in VB6

this time i will show you on how to capitalize every first letter of a word in a Text box Control,
follow the codes below:

This code will write on a module as a function just copy and paste on a module

Public capT As Object

Public Sub cap(frm As Form)
cr = vbCrLf

For Each capT In frm.Controls
 If TypeOf capT Is vkTextBox Then
 t = capT.Text
        If t <> "" Then
         Mid$(t, 1, 1) = UCase$(Mid$(t, 1, 1))
         For i = 1 To Len(t) - 1
           If Mid$(t, i, 2) = cr Then Mid$(t, i + 2, 1) 
               = UCase$(Mid$(t, i + 2, 1))
           If Mid$(t, i, 1) = " " Then Mid$(t, i + 1, 1) 
             = UCase$(Mid$(t, i + 1, 1))
         Next
         capT.Text = t
        End If
    End If
Next capT
End Sub

Hope you Like it
Happy Coding
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

How to Add Icon on List View

This sample tutorial is showing you on how to add an icon or image on a List-view control on
your own program:
1.) you must Add Microsoft Windows Common Controls  6.0 (SP6) , to simply add a  
List-view Control and a  Image-list Control:

2.) set up the List-view Control on your form and also a  Image-list Control, to set a List-view 
on a General Tab set the View to Report, like show on the figure below:




















then you must add a Column Header for your column  Title like shown Below:























then click Apply button .

4.) to put an Image on a Image List just follow the steps below right-click the Image-list >
Properties and the Property Dialog will prompt


















at General Tab choose the size of the image you want  then at the Image Tab click Insert 

Picture like shown below: then the Select Picture Dialog will Prompt for you to add image
on a Image List, then click Open button the OK.
















then the simple code will look like this: the code will placed on the Form Load event

Private Sub Form_Load()
'first you must declare a variable that holds as Listitem
    Dim panoy As ListItem
'lv1 is the Listview name so we can initialized first like shown
'below
          lv1.SmallIcons = ImageList1
'set the listitem 
              Set panoy = lv1.ListItems.Add(, , "Panoy")
'and the icon will down to this code calling the image
'on a imagelist and the index of image is 1
        panoy.SmallIcon = 1       
End Sub

and the output  will look like this:























Happy Coding (^_^)
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

Run Time Error 35613

"Imagelist must be initialized before it can be used" if you got this error message, your  
imagelist is need to initialized first before declaring it for the certain used.for example if the
imagelist is used as a image container for a Listview control so before you declare it via this
code:

    panoy.smallicon=1

with out initializing imagelist,you always got this error so to avoid this kind of error you need
to initialized first through this code

    listview1.smallicons=imagelist1

so i think this will help for those beginners on vb6 programming
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

Cant find Project or Library

Hello guys this time i will discuss it to you on how to solved this error CANT FIND 
PROJECT OR LIBRARY, this is error will usually encounter, if there are missing
REFERENCE on your project, to solved  it just go to  Project Tab>Reference>
then unchecked all the listed  Missing Reference.

on my case, i encounter this error when i reformatted my laptop and i  run my projects,
the error dialog box prompt says CANT FIND PROJECT OR LIBRARY, all the
built vb functions that i used will highlighted, like the   Right,left,date,time,chr etc. just 
because of a missing  reference of crystal reports, after i unchecked those reference 
my projects runs normally.
Note: this solution is based only on my experienced 
using a Visual  Basic 6.0,but hoped this will help or 
giving you a hint on how to solved your own problem

 
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

How to Filter the Special Characters in Vb6

This sample line of codes will show you on how to filter all
the special character on your keyboard that will inputted by
the user, this is very important to avoid the typo error, so we
want to trap it via this code

If KeyAscii >= 1 And KeyAscii <= 7 Or _

       KeyAscii >= 9 And KeyAscii <= 47 Or _

       KeyAscii >= 58 And KeyAscii <= 64 Or _

       KeyAscii >= 91 And KeyAscii <= 96 Or _

       KeyAscii >= 123 And KeyAscii <= 255 Then

            KeyAscii = 0

    End If

By determining the equivalent value of each character
you can browse your ASCII code,on the code given
i will not include the 65 to 90 because this range are holds
the value of A-Z and 48-57 that holds the range 0-9.
Hope this will help
Good Luck (^_^)
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

How to Create Table on SQL Server

Here the Following steps on how to create Table on your
SQL Server 2005

On your Database that you Created just click the cross
box to view it on a hierarchical form shown on  the image
below, by creating database just follow this link
How to Create a Database on SQL Server 2005,
then on the Tables just simply right-click  and press
New Table


























After pressing New Tables this will prompt to you or also
known as the Design View, Insert your Column Name,
and Specified the Data Types,and Allowing Nulls if you
want to not Duplicate the Value of the data or the value of
ID_Num to avoid Data Redundancy just unchecked the
box,or you want to duplicate it just leave it with checked














Then Click Save and prompting the Choose Name Dialog
so choose your table name at this time i type Employees



















Then you can see your table under  Tables,just click the cross box
it will show the dbo.Employees,it will show also at the summary at the
right pane of object explorer
























or we can also create table via SQL Query by doing this
just press New Query Tab, then enter this following code

--this will create also the Employees table
CREATE TABLE Employees (

     ID_Num int NOT NULL,
     First_Name varchar (25),
     Last_Name varchar(50),
    Middle_Name varchar(50),

)


Good Luck (^_^)
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

How to Create Database on SQL Server

this is the basic steps on how to create your own database on
your SQL Server 2005

At the Object Explorer window just right-click the database
then click New Database like shown on the image below.
























After pressing the New Database this will prompt the
New DatabaseDialog window, at obviously your
database name

Database Name: (Type your Database Name)
Owner: (set default)
at this time let filled up with Payroll database
then press the OK button not the Add Button





















Then after the Payroll database will added on your server and
it will show also on the summary window show at the right



















by Creating a Table just Follow this link below
How to Create Table on SQL Server

Good Luck!!!!!
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

How to Calculate Date using Date Diff and Date Add Function

this code will show you on how to calculate the difference of  two dates like for example 1
0/10/2010 to 10/01/2010 to find the lapsed day we use a Date Diff function that is 
built in VB6 so the code will look like this:

Label1.Caption = DateDiff("d", #10/1/2010#, #10/10/2010#)

at this code i display the output on a label control did you notice that the Date Diff function i
s there,since i am looking for  day lapsed to 10/01/2010 to 10/10/2010 the output is 9 if you 
are looking for a month just simply change the letter "d" to letter  "m" for a month symbol
and of  course it is not complete if i did  not include for a year,so for the year calculation just
simply change  also the letter on a two double quote(" ") to a "yyyy" and you  got the answer......

for a Month:
DateDiff("m", #10/1/2010#, #10/10/2010#)

 for a Year:
DateDiff("yyyy", #10/1/2010#, #10/10/2010#)

For the Date Add function for example we have add 3 days on the current date so it will
done like this:

this will add 3 days on your current system date 
 DateAdd("d", 3, Now)

this will add 3 months on your current system date
for a Month:
DateAdd("m", 3, Now)

 this will add 3 years on your current system date for a Year:
DateAdd("yyyy", 3, Now)

 Hope this will help to you!!
Happy Coding
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

How to Create a Stored Procedure in SQL Server

Hello guys this is the basic way on how to simply Create a Stored Procedure in Sql Server
2005 just follow the Steps that shown on the Image below























Click Database then























Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

Nested IF

This is the basic Code for Nested IF Structure in vb6

Dim Adrian, Panoy As Integer

Adrian = Val(Text1.Text)'holds the value of text1
Panoy = Val(Text2.Text)'holds the value of text2

    If Adrian = 100 Then ' if  Adrian=100 then it will  to the next if

        If Panoy = 100 Then 'if Panoy=100 then msgbox Prompt

            MsgBox "You Got it"

        End If

    End If
           
End Sub

Happy Coding
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

Do Loop Until

This the Basic code of Do Loop Until in Vb6

Private Sub Command1_Click()

Dim Adrian As Integer 'holds the Value of 1 to 10

    Adrian = 1'set the value to 1

    Do

        Print Adrian ' print the value

            Adrian = Adrian + 1 ' increment by 1 from original value

    Loop Until Adrian = 10 'end after Adrian=10
   
'this will print the numbers 1-9

End Sub

Happy Coding
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

Copyright @ Codes-47.Blogspot.Com. Powered by Blogger.