Visual Basic 6.0 translation

Tuesday, December 25, 2012

Visual Basic Online Course - Understanding the control resizing method

 Visual Basic Online Course

How does (Re-sizing) work ?

Download the example (MediaFire.com link)

Understanding how resizing controls work !

The basic Idea of resizing :

When resizing : Control Width grows and shrinks when form (Container) grows and shrinks with (Module). The (Modu) is the growing or shrinking Module ....

Let say we have  a control (Width = 10) on a form (Width = 20) then (Control : Width) = (10 : 20)

So when resizing the (form to = 40) then the (Control will grow to = ???) --------- Answer :
   ( 10 : 20 ) = ( ??? : 40)
   ??? = 20 , Why ?

Because the (Modu = [40 / 20]), then the ??? = 10 * Modu
??? = 20 ......... And so on ...

In the example attached you will notice that resizing the form with cause resizing the control as well.
Thanx for reading


Thursday, December 20, 2012

Visual Basic Online Course - ProgressBar Colors

Visual Basic Online Course

How to change the ProgressBar colors by code

Visual Basic Progressbar
Progressbar


The ProgressBar control in Visual Basic 6.0 is replaced by the Windows Forms ProgressBar control in Visual Basic 2005. The names of some properties, methods, events, and constants are different, and in some cases there are differences in behavior.

Conceptual Differences

Negotiate Property

In Visual Basic 6.0, the Negotiate property of a ProgressBar control can be used to automatically hide the control when a toolbar is displayed.
The Visual Basic 2005 ProgressBar control does not have a Negotiate property; you can achieve the same effect by setting the Visible property to false at run time.

Orientation Property

In VB6, a Progress Bar control can be displayed either horizontally or vertically by setting the Orientation property. The Visual Basic 2005 ProgressBar control can only be displayed horizontally.

Create New (Module)


Then in the form_load() section



Monday, December 3, 2012

Visual Basic Online Course - WildCards in Database

Visual Basic Online Course

Using Wild Cards when searching Database

Problem : I have 50 records of mobile phone numbers and they start with different digits according to network area code, I want to search the [MobileNo] record from [TextBox] so when I write the first digit i get some search result and the second digit returns the next search result .... etc as i go, using TextBox1_Change() event, i want when every time i type a digit i get a result in the DataGrid control

Solution Using ADO + MS-Access 2003 + Sql Statements


That means : Search all records that contain these values within.
But, If you want to search for records start with certain values, then use :

And, If you want to search for records end with certain values, then use :


Thursday, November 29, 2012

Visual Basic Online Course - Run-time error '3021' : Either BOF or EOF is True, or the current record has been deleted.

Visual Basic Online Course

Run-time error '3021' : Either BOF or EOF is True, or the current record has been deleted.
Case :
In Visual Basic 6.0 project with Database (e.g: MS-Access 2003) table, while trying to navigate through records you get the following error message.
Error No. :
3012
Error description :
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record
Solution :



Saturday, November 10, 2012

Visual Basic Online Course - Retrieve Structure of a Database Tables and Views

 Visual Basic Online Course 
OpenSchema

OpenSchema Method


  • How do I list all Views only, from within my Database ?
     - Retrieve all the Queries/Views only from MS-Access 2003 Database into VB6 using the code.
Using OpenSchema Method
Example Code :



- If you wish to list all the tables only, then change this line :
If RS!TABLE_TYPE.Value = "VIEW" Then
To
If RS!TABLE_TYPE.Value = "Table" Then

- If you wish to list all Tables and Views.
Simply remove the "If , Else" Statement.

Regards,

Thursday, June 7, 2012

Visual Basic Online Course - Create FTP

Visual Basic Online Course - Create FTP Client

VB6 Ftp Client
VB6 Ftp Client


In this project we shall discuss using Microsoft Internet Transfer Control or (INET.Ocx) to :
  1. Connect to FTP remote server.
  2. Retrieving main/sub directories from FTP remote server.
  3. Retrieving files from FTP remote server.
  4. Uploading file to FTP remote server.
  5. Downloading file from FTP remote server.
  6. Make new directory (folder) at FTP remote server.
  7. Rename & Delete file from FTP remote server.

In this project we won't be using API calls (i.e. INET API) also we will cover these issues :
    1. The Spaces problem while downloading and uploading files.
    2. Error message "Still executing last request" number 35764.
    3. Error message "File exists"
    4. Application Hangs up after ending it.
    5. Using TreeView control to list all the Directories on the FTP remote server.
    6. Using ListBox control to list all files on the FTP remote server related to above folder.


  • The project source code is uploaded to Mediafire.com direct link and no password.


  • The project exe file tested and debugged uploaded to Mediafire.com direct link and no password.


  • I will demonstrate a brief explanation now on how does it work and how did i code it to make things easy to follow the logic.

  • Visual Basic Online Course - MS Access 2003 Database Structure

    Visual Basic Online Course
    MS Access 2003 Database Structure

    These are 2 methods on how to work with MS-Access 2003 Database components directly like (Tables & Queries) without opening your Data-Base file using ADO 2.8 .
    1) Using OpenSchema
    - Create new MS-Access 2003 DB (MyDb.mdb)
    - Create VB6 Project
    - Database (Fname Text 50,Lname Text 50, Nphone Text 50, Xemail Text 50)
    - Place both in the same directory of course.
    - Open your VB6 Project, from menu choose
    (Project, References, Microsoft Ado 2.8 and Microsoft ADOx)
    click to enlarge

    - Visual Basic Code Snippets :


    Source Code - MediaFire.com Link

    Monday, June 4, 2012

    Visual Basic Online Course - Auto translate your application's Language before compiling

      Visual Basic Online Course

    Auto translate your application's language

     Using Conditional Compilation

    Conditional compilation lets you selectively compile certain parts of the program. You can include specific features of your program in different versions, such as designing an application to run on different platforms, or changing the date and currency display filters for an application distributed in several different languages.

    Structuring Code for Conditional Compiling

    To conditionally compile a part of your code, enclose it between #If...Then and #EndIf statements, using a Boolean constant as the branching test. To include this code segment in compiled code, set the value of the constant to –1 (True).
    For example, to create French language and German language versions of the same application from the same source code, embed platform-specific code segments in #If...Then statements using the predefined constants conFrenchVersion and conGermanVersion.
    #If conFrenchVersion Then
       ' .
    #ElseIf conGermanVersion then
       ' .
    #Else
       ' .
    #End If
    

    If the value of the conFrenchVersion constant is set to True at compile time, the conditional code for the French language version will be compiled. If the value of the conGermanVersion constant is set to True, the compiler uses the German language version.

    Declaring Conditional Compilation Constants


    There are three ways to set conditional compilation constants: in the Conditional Compilation Arguments field of the Make tab on the Project Properties dialog box, on a command line, or in code.

    Conditional compilation constants have a special scope and cannot be accessed from standard code. How you set a conditional compilation constant may depend on the scope you want the constant to have.
    How Set Scope
    Project Properties dialog box Public to all modules in the project
    Command line Public to all modules in the project
    #Const statement in code Private to the module in which they are declared


    Setting Constants on the Project Properties Dialog Box

    Before creating the executable file, from the Project menu, choose Project Properties, click the Make tab on the Project Properties dialog box, and enter an argument, such as conFrenchVersion = –1, in the Conditional Compilation Arguments field (if you are compiling your application for the French language version). When you compile the program, this argument will satisfy the #If...Then condition, and the code between the #If...Then and #EndIf statements will be included in the compiled program.
    If you have a complex #If...Then statement, containing one or more #ElseIf statements, you will need to set additional constants. You can set multiple constants by separating them with colons, as in the following example:
    conFrenchVersion=-1:conANSI=0
    

    Setting Constants on the Command Line

    If you want to start compilation from a command line, use the /d switch to enter conditional compilation constants, as shown here:
    vb6.exe /make MyProj.vbp /d conFrenchVersion=–1:conANSI=0
    No space is required between the /d switch and the first constant. Command-line declarations override declarations entered on the Project Properties dialog box, but do not erase them; arguments set on the Project Properties dialog box remain in effect for subsequent compilations.
    For More Information   See "#If…Then…#Else Directive" and "#Const Statement."

    I posted it here in case (Microsoft) stopped supporting, which will happen any time.
    Source (http://msdn.microsoft.com/en-us/library/aa240847%28v=vs.60%29)

    Regards,

    Wednesday, May 16, 2012

    Visual Basic Online Course - How to make sure all TextBoxes on form are not empty

    Visual Basic Online Course

     How to check if all TextBoxes on form are Empty or not ?!



    - In VB.Net it is easy to check if all textboxes values are empty or not, but in Visual Basic 6.0 it is quite tricky because there is no (String.IsNotNullOrEmpty) in VB 6.0.




    - Let say you have VB 6.0 Project with Database of any sort, your VB6.0 Project has many TextBoxes (i.e. 15 TextBoxes), and you're adding 10 textboxes contents into a database table fields, and all of them are required (*), so you can do something like this :


    You'd need something more flexible and not too long to write every time, also you'd need something dynamic.

    - Or -

    I've found this page that solved the problem for me and i thought that it would be helpful to share it .

    Here is the link
    And you can add this block of code to a sub and use it, or even a function. But this is not gonna help you if you decided to change your logic of adding data to database.

    Visual Basic Online Course

    vb6 (63) Application Development (45) Visual Basic Online Course (45) Online Visual Basic Course (44) Visual Basic Help (44) Visual Basic Programming (42) IT Jobs (39) VB6 developer (38) Visual Basic Course (38) Visual Basic 6.0 (26) Microsoft Visual Basic 6.0 (25) VB6.0 (24) Visual Basic Programmers (24) vb 6.0 (24) visual basic programming tutorial (19) Third lesson (16) Source code download for Visual Basic 6.0 (14) Source code for Visual Basic 6.0 (10) visual basic tutorial (9) Visual Basic 6 (5) Visual Basic Courses (5) Lesson 3 (4) VB 0.6 - TreeView control (4) VB 0.6 With TreeView Control (4) VB6 Course (3) Create ActiveX (2) How to automate MS-Access from Visual Basic 6.0 (2) Add controls at runtime (1) Back up your Database (1) Change ActiveX icon (1) Change screen resolution (1) Create FTP (1) Crystal Reports 4.6 (1) Crystl32.ocx could not be loaded (1) DataGrid Columns re-size (1) Date Calculation (1) DateAdd Function (1) DateDiff function (1) FTP (1) Marquee Title Bar (1) Marquee VB 6.0 TitleBar (1) Method 'Action' of object 'CrystalCtrl' Failed (1) Microsoft Access with Visual Basic 6.0 (1) OpenSchema method (1) Save File Using CommonDilog (1) Track Database path (1) VB 0.6 - Registry (1) VB 0.6 With Registry Editor (1) VB 6.0 Access (1) VB 6.0 OOP (1) VB6 Access2003 ADO Like % (1) VB6 Add Date (1) VB6 Add Time (1) VB6 Date calculation (1) VB6 Subtract Date (1) Visual Basic Remote (1) Win7 (1) Windows7 (1) ms access networking details (1) remote Visual Basic DB (1) rounded and transparent forms (1) vb 0.6 style (1) vb 6.0 Remote Database (1)