<xmp> <noscript><xmp> <body><!--'"</title></head>--> <script type="text/javascript"> //OwnerIQ var __oiq_pct = 50; if( __oiq_pct>=100 || Math.floor(Math.random()*100/(100-__oiq_pct)) > 0 ) { var _oiqq = _oiqq || []; _oiqq.push(['oiq_addPageBrand','Lycos']); _oiqq.push(['oiq_addPageCat','Internet > Websites']); _oiqq.push(['oiq_addPageLifecycle','Intend']); _oiqq.push(['oiq_doTag']); (function() { var oiq = document.createElement('script'); oiq.type = 'text/javascript'; oiq.async = true; oiq.src = document.location.protocol + '//px.owneriq.net/stas/s/lycosn.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(oiq, s); })(); } /////// Google Analytics var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-21402695-21']); _gaq.push(['_setDomainName', 'angelfire.com']); _gaq.push(['_setCustomVar', 1, 'member_name', 'planet/janzb', 3]); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); ////// Lycos Initialization ///////////////////// var lycos_ad = Array(); var lycos_search_query = ""; var lycos_onload_timer; var cm_role = "live"; var cm_host = "angelfire.lycos.com"; var cm_taxid = "/memberembedded"; var angelfire_member_name = "planet/janzb"; var angelfire_member_page = "planet/janzb/visualbasic.html"; var angelfire_ratings_hash = "1556294664:2ea5b6d139e118aef59a18e152b47401"; var lycos_ad_category = null; var lycos_ad_remote_addr = "34.230.84.215"; var lycos_ad_www_server = "www.angelfire.lycos.com"; var edit_site_url = "www.angelfire.lycos.com/landing/landing.tmpl?utm_source=house&utm_medium=landingpage&utm_campaign=toolbarlink"; </script> <script type="text/javascript" src="http://scripts.lycos.com/catman/init.js"></script> <script type='text/javascript'> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; var useSSL = 'https:' == document.location.protocol; gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })(); </script> <script type='text/javascript'> googletag.cmd.push(function() { googletag.defineSlot('/95963596/ANG_300x250_dfp', [300, 250], 'div-gpt-ad-1450207484070-0').addService(googletag.pubads()); googletag.enableServices(); }); </script> <script type='text/javascript'> googletag.cmd.push(function() { googletag.defineSlot('/95963596/ANG_above_728x90_dfp', [728, 90], 'div-gpt-ad-1450207484070-1').addService(googletag.pubads()); googletag.enableServices(); }); </script> <script type='text/javascript'> googletag.cmd.push(function() { googletag.defineSlot('/95963596/ANG_below_728X90_dfp', [728, 90], 'div-gpt-ad-1450207484070-2').addService(googletag.pubads()); googletag.enableServices(); }); </script> <script type="text/javascript"> (function(isV) { if (!isV) { return; } //this.lycos_search_query = lycos_get_search_referrer(); var adMgr = new AdManager(); var lycos_prod_set = adMgr.chooseProductSet(); var slots = ["leaderboard", "leaderboard2", "toolbar_image", "toolbar_text", "smallbox", "top_promo", "footer2","slider"]; var adCat = this.lycos_ad_category; adMgr.setForcedParam('page', (adCat && adCat.dmoz) ? adCat.dmoz : 'member'); if (this.lycos_search_query) { adMgr.setForcedParam("keyword", this.lycos_search_query); } else if (adCat && adCat.find_what) { adMgr.setForcedParam('keyword', adCat.find_what); } for (var s in slots) { var slot = slots[s]; if (adMgr.isSlotAvailable(slot)) { this.lycos_ad[slot] = adMgr.getSlot(slot); } } adMgr.renderHeader(); adMgr.renderFooter(); }((function() { var w = 0, h = 0, minimumThreshold = 300; if (top == self) { return true; } if (typeof(window.innerWidth) == 'number' ) { w = window.innerWidth; h = window.innerHeight; } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { w = document.documentElement.clientWidth; h = document.documentElement.clientHeight; } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { w = document.body.clientWidth; h = document.body.clientHeight; } return ((w > minimumThreshold) && (h > minimumThreshold)); }()))); window.onload = function() { var f = document.getElementById("lycosFooterAd"); var b = document.getElementsByTagName("body")[0]; b.appendChild(f); f.style.display = "block"; document.getElementById('lycosFooterAdiFrame').src = '/adm/ad/footerAd.iframe.html'; // Slider Injection (function() { var e = document.createElement('iframe'); e.style.border = '0'; e.style.margin = 0; e.style.display = 'block'; e.style.cssFloat = 'right'; e.style.height = '254px'; e.style.overflow = 'hidden'; e.style.padding = 0; e.style.width = '300px'; })(); // Bottom Ad Injection ( function() { var b = document.getElementsByTagName("body")[0]; var iif = document.createElement('iframe'); iif.style.border = '0'; iif.style.margin = 0; iif.style.display = 'block'; iif.style.cssFloat = 'right'; iif.style.height = '254px'; iif.style.overflow = 'hidden'; iif.style.padding = 0; iif.style.width = '300px'; iif.src = '/adm/ad/injectAd.iframe.html'; var cdiv = document.createElement('div'); cdiv.style = "width:300px;margin:10px auto;"; cdiv.appendChild( iif ); if( b ) { b.insertBefore(cdiv, b.lastChild); } })(); } </script> <style> #body .adCenterClass{margin:0 auto} </style> <div style="background:#abe6f6; border-bottom:1px solid #507a87; position:relative; z-index:9999999"> <div class="adCenterClass" style="display:block!important; overflow:hidden; width:916px;"> <a href="http://www.angelfire.lycos.com/" title="Angelfire.com: build your free website today!" style="display:block; float:left; width:186px; border:0"> <img src="/adm/ad/angelfire-freeAd.jpg" alt="Site hosted by Angelfire.com: Build your free website today!" style="display:block; border:0" /> </a> <div id="ad_container" style="display:block!important; float:left; width:728px "> <script type="text/javascript">document.write(lycos_ad['leaderboard']);</script> </div> </div> </div> <!-- ///////////////////////////////////// --> <script type="text/javascript">document.write(lycos_ad['slider']);</script> <div id="lycosFooterAd" style="background:#abe6f6; border-top:1px solid #507a87; clear:both; display:none; position:relative; z-index:9999999"> <div class="adCenterClass" style="display:block!important; overflow:hidden; width:936px;"> <div id="aflinksholder" style="float:left; width:186px;"> <a href="http://www.angelfire.lycos.com/" title="Angelfire.com: build your free website today!" style="display:block; border:0"> <img src="/adm/ad/angelfire-freeAd2.jpg" alt="Site hosted by Angelfire.com: Build your free website today!" style="display:block; border:0" /> </a> </div> <iframe id="lycosFooterAdiFrame" style="border:0; display:block; float:left; height:96px; overflow:hidden; padding:0; width:750px"></iframe> </div> </div> </xmp></noscript>
                            ~Visual Basic  Tips~



This website is for IT  students,computers users and would-be programmers In this site we give soem Tips and tricks   qucik way to learn Vb so You will be quickly creating applications by following the simple examples. All the applications featured are fully functional windows applications with all the usual user-interface controls such as command buttons, labels and textboxes.
As long as you are familiar with Windows 95, you can easily create applications with Visual Basic. You don't have to be a windows expert, but you should feel comfortable working with menus, the mouse and the windows interface. If you've opened, closed and re-sized windows you should have the ability to make your own Visual Basic applications in no time at all.
A Computer cannot understand any persons spoken language. A spoken language such as English , French, is simply too general and ambiguous for computers to understand. Therefore, we must adapt to the machine and learn the computer language so that the computer can understand. This is where visual basic comes into it - when you type visual basic source code into the computer, the computer processes these statements into Visual Basic language. The statements in visual basic, however, do not have multiple meanings within the same context.
This sounds great what else will I need!?
You will require a Windows 95-compatible computer with at least Windows 95 or Windows NT installed and must importantly Visual Basic!. At the momenet there is no freeware version of Visual basic available
Enjoy!  my some Post "VB TIPS"
.................................................................................................................................
By: Jahanzeb Khan Date: 07/10/2004

This is an easy way to get the file size of any file a user might select. Lets assume you have a form with a directory list box called mydir and a file list box named myfile. The user can scroll to any directoy on their hard drive, select a file from the file list box and the program will tell them the size of that file. Heres the code:
oldfile = mydir & "\" & myfile
oldsize = FileLen(oldfile)

Now you can create a lable on your form that will display
the size of the file. Try this:
lblFileSize.Caption = "The file is " & _
oldsize & " bytes in size."

Of course, if you want the lable to display a large file
with commas in the correct place, you will have to format
oldsize. Do it like this:
lblFileSize.Caption = "The file is " & _
Format(oldsize, "#,###,##0") & " bytes in size."
..................................................................................................................................................................
By:Jahanzeb khan Date: 21/10/2004

There are two ways to get the size of a file. If the file is open in your program, use the LOF function:
LOF(filenumber)

Where filenumber is the number of the file as specified in the Open statement. Example:
Open "C:\Work\MyFile.Txt" For Input As #1 'Open the file
size = LOF(1)                             'Get file size
Close #1                                 'Close the file

If the file is not open in your program, you will need to use the FileLen function:
FileLen(filepath)

With filepath replaced by the name and path of the file. To view the size of the file of the above example, but without opening it, we'll type the code:
size = FileLen("C:\Work\MyFile.Txt")

In both examples, the size variable will contain the size, in bytes, of C:\Work\MyFile.Txt.
..................................................................................................................................................................
By:Jahanzeb khan Date: 23/11/2004

Visual Basic does not include an "Explorer" control to list files: the only resource is the Dir function.
The following code, that makes use of the Dir function and of a couple of arrays, fills a listbox (lstFiles) with all the files in a directory, sorted by date.
Dim DirPath As String
Dim Pattern As String
Dim FileName As String
Dim Unsorted() As String
Dim Sorted() As String
Dim Max As Date
Dim MaxN As Integer
Dim a As Integer
Dim b As Integer

'Define the target of search
DirPath = "C:\"       'must end with backslash!
Pattern = "*.*"      'search criteria all files must meet

ReDim Unsorted(0)

'Search for files
FileName = Dir(DirPath & Pattern)
Do
    If FileName = "" Then Exit Do
    If FileName <> "." And FileName <> ".." Then
        'Add valid file to unsorted array
        ReDim Preserve Unsorted(UBound(Unsorted) + 1)
        Unsorted(UBound(Unsorted)) = FileName
    End If
    FileName = Dir()
Loop

ReDim Sorted(UBound(Unsorted))

'Now sort the array by date
For a = 1 To UBound(Sorted)
    Max = 0
    MaxN = -1
    For b = 1 To UBound(Unsorted)
        If Unsorted(b) <> "" Then
            If FileDateTime(DirPath & Unsorted(b)) > Max Then
                Max = FileDateTime(DirPath & Unsorted(b))
                MaxN = b
            End If
        End If
    Next b
    Sorted(a) = Unsorted(MaxN)
    Unsorted(MaxN) = ""
Next a

'Fill the listbox with the sorted array
lstFiles.Clear
For a = 1 To UBound(Sorted)
    lstFiles.AddItem Sorted(a)
Next a

..................................................................................................................................................................
By: Jahanzeb Khan Date: 21/12/2004

Use this code to read a text file in a textbox. Remember that, if the file exceeds 64K in size, you will get Error 7 (Out of memory).
Open filename for Input as #filenumber
textbox.Text = Input(LOF(filenumber), #filenumber)
Close #filenumber

filenumber is a free number for the fil filename, and textbox is the textbox to read the file in. Example: to read the file C:\Manual.Txt in the textbox Text1, use this code:
Open "C:\Manual.Txt" For Input As #1 'Open the file
Text1.Text = Input(LOF(1), #1)       'Read the file
Close #1                              'Close the file
..................................................................................................................................................................

By: Jahanzeb Khan Date: 16/1/2005

This tip shows you how to retrieve the short path name for a file. A name like "C:\My Documents\Long Name.doc" becomes "C:\MyDocu~1\LongNa~1.doc".
It is possible through the GetShortPathName API function.

The following is the API declaration to paste into the Declarations section of a module:
Declare Function GetShortPathName Lib "kernel32" Alias _
"GetShortPathNameA" (ByVal lpszLongPath As String, ByVal _
lpszShortPath As String, ByVal lBuffer As Long) As Long

Copy the following function into a form/module:
Public Function GetShortPath(strFileName As String) _
As String Dim lngRes As Long
    Dim strPath As String
    strPath = String$(165, 0)
    lngRes = GetShortPathName(strFileName, strPath, 164)
    GetShortPath = Left$(strPath, lngRes)
End Function

The use is very easy. Here's an example:
Dim ShortPath As String
ShortPath = GetShortPath("C:\My Documents\Long Name.doc"

ShortPath will be set to "C:\MyDocu~1\LongNa~1.doc".

..................................................................................................................................................................
By: Jahanzeb Khan Date: 24/1/2005

You may have an occasion to want to use the common dialog box as a directory-picker instead of creating a separate form and placing a directory control on it.
'Initialize Common Dialog control
With cdMain
  .Flags = cdlOFNPathMustExist
   .Flags = .Flags Or cdlOFNHideReadOnly
   .Flags = .Flags Or cdlOFNNoChangeDir
   .Flags = .Flags Or cdlOFNExplorer
   .Flags = .Flags Or cdlOFNNoValidate
   .filename = "*.*"
End With

The cdlOFNNoValidate seting permits the user to press "Open" while no single file is selected. The filename setting of "*.*" now satisfies the common dialog.

To parse the directory, use the following logic from where you present the dialog:
Private Sub btnBrowse_Click()
    Dim x As Integer
    'Cheap way to use the common dialog box as a directory-picker
    x = 3

    cdMain.CancelError = True    'Do not terminate on error

    On Error Resume Next        'I will hande errors

    cdMain.Action = 1            'Present "open" dialog

    'If FileTitle is null, user did not override the default (*.*)
    If cdMain.FileTitle <> "" Then x = Len(cdMain.FileTitle)

    If Err = 0 Then
        ChDrive cdMain.filename
        txtPath.Text = Left(cdMain.filename, Len(cdMain.filename) - x)
    Else
        'User pressed "Cancel"
    End If

End Sub
...............................................................................................................................................................
By: Jahanzeb Khan Date: 23/2/2005

Each time a disk is formatted, the operationg system assigns a 32-bit number that can be considered unique. That is the disk's serial number.

Start with adding the following API Declarations to the Declarations section of a form/module:
Private Declare Function GetVolumeInformation Lib _
"kernel32.dll" Alias "GetVolumeInformationA" (ByVal _
lpRootPathName As String, ByVal lpVolumeNameBuffer As _
String, ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, lpMaximumComponentLength _
As Long, lpFileSystemFlags As Long, ByVal _
lpFileSystemNameBuffer As String, ByVal _
nFileSystemNameSize As Long) As Long

Now, paste the following Function into the same form/module:
Function GetSerialNumber(DriveLetter As String) As String
    Dim SerialNum As Long
    Dim VolNameBuf As String
    Dim FileSysNameBuf As String
    Select Case Len(DriveLetter)
        Case 1
            If LCase(DriveLetter) Like "[a-z]" Then
                DriveLetter = Left(DriveLetter, 1) & ":\"
            Else
                GetSerialNumber = "Error - Bad drive designation"
            End If
        Case 2
            If LCase(DriveLetter) Like "[a-z]:" Then
                DriveLetter = DriveLetter & "\"
            Else
                GetSerialNumber = "Error - Bad drive designation"
            End If
        Case 3
            If LCase(DriveLetter) Like "[!a-z]:\" Then
                GetSerialNumber = "Error - Bad drive designation"
            End If
        Case Else
            GetSerialNumber = "Error - Bad drive designation"
    End Select
    If Len(GetSerialNumber) = 0 Then
        VolNameBuf = String(255, Chr(0))
        FileSysNameBuf = String(255, Chr$(0))
        GetVolumeInformation DriveLetter, VolNameBuf, _
         Len(VolNameBuf), SerialNum, 0, 0, _
         FileSysNameBuf, Len(FileSysNameBuf)
        GetSerialNumber = Right("00000000" & Hex(SerialNum), 8)
    End If
End Function

Once you've done the above, the use of the function is simple. The following instruction pops-up a box with drive C serial number:
MsgBox GetSerialNumber("C:")

Instead of "C:", you can type "C:\" or just "C": all forms are accepted!

The serial number will be shown in hex, as it is usually viewed. If you prefer to see it as a long number, replace the 3rd-last line of the code with the following:
GetSerialNumber = SerialNum
..................................................................................................................................................................
By: Jahanzeb Khan Date: 29/03/2005

In Windows Explorer, when you right-click a file and select "Properties", a window comes up with various file information: name, type, path, date created, edited, etc. This tip shows you how to do the same thing with Visual Basic code.

First, cut and paste the following API declaration code into the Declarations section of a form.
Private Const SW_SHOW = 5
Private Const SEE_MASK_INVOKEIDLIST = &HC
Private Type SHELLEXECUTEINFO
    cbSize As Long
    fMask As Long
    hwnd As Long
    lpVerb As String
    lpFile As String
    lpParameters As String
    lpDirectory As String
    nShow As Long
    hInstApp As Long
    'Optional fields
    lpIDList As Long
    lpClass As String
    hkeyClass As Long
    dwHotKey As Long
    hIcon As Long
    hProcess As Long
End Type
Private Declare Function ShellExecuteEx _
Lib "shell32.dll" (ByRef s As SHELLEXECUTEINFO) As Long

Second, copy the following Sub into the same form.
Public Sub DisplayFileProperties(ByVal sFullFileAndPathName As String)
    Dim shInfo As SHELLEXECUTEINFO

    With shInfo
        .cbSize = LenB(shInfo)
        .lpFile = sFullFileAndPathName
        .nShow = SW_SHOW
        .fMask = SEE_MASK_INVOKEIDLIST
        .lpVerb = "properties"
    End With

    ShellExecuteEx shInfo
End Sub

The use is very simple: the following code is an example.
Dim sFileName As String
sFileName = "filename"
If Len(Dir(sFileName)) = 0 Then
    MsgBox "File: " & sFileName & " cannot be found"
    Exit Sub
End If
DisplayFileProperties sFileName

Obviously "filename" is the name of the file you want to show properties of (i.e. "C:\Windows\Media\Ding.Wav").
..................................................................................................................................................................
ÓBy Jahanzeb Khan artopa (Hazro) Attock
Online users
Change background
www.Smilepkdot.TK
Gmail tips|  google talk| Islam| tips and tricks|  nokia secrets|
cool vb| qruan reciting   Zakat calculator| Free E-Books| window registry |
Dos tips|  hacking by java| mobile secret code| links|  webpage designing|
firefox| visual basic |bosinian war| Makkah |prayer time calculator|