Free Web Hosting by Netfirms
Web Hosting by Netfirms | Free Domain Names by Netfirms


.

Home to new Visual Basic .NET programmers

Methods

 

Home ] What is this site? ] myExercises ] myTutorials ] myExam ] myMicrosoft ] myNotes ] Study Advice ] myLinks ]


Search (my)Visual Basic .NET

(Tip: Scroll past sponsored links to see your search results for this website)


Complain to Volkswagen South Africa (VWSA)


New to myExercises:

 

Lynnwood Consultants Program
Computer Calculator Program
Funny Time Program
Creative Minds Login Program
Hatfield Pizza & Pasta Program
  Shutterbug Program

New to myNotes:

 

>>

TOE chart


Order this book today from

kalahari.net: click-click, ding-dong

 

Title: Microsoft Visual Basic 2005:

         RELOADED, Second Edition

Author:  Diane Zak

 

Click the image below to order your copy.

 

Up ] GUI Standards ] Access Files ] Accumulators, Counters & Averages ] Arrays ] Collections ] Constants & Enumerators ] Crystal Reports ] Data Types ] Flowchart Symbols ] Functions ] Keywords ] Methods ] Operators ] Repetition Structures ] Selection Structures ] Sub Procedures ] Toolbox Controls ] Variables ] Windows Forms ]


 

Add

Print

AppendText

RadioButton.PerformClick
Array.Reverse Random.Next
Array.Sort Random.NextDouble
Button.PerformClick ReadLine
Close Remove
CreateText Replace

Debug.Write

SelectAll

Debug.WriteLine

SetBounds

e.Graphics.DrawString

ShowDialog
EndsWith StartsWith
Exists Substring
Fill ToLongDateString
Focus ToLongTimeString
IndexOf ToShortDateString
Insert ToShortTimeString
Me.Close ToString
MessageBox.Show Trim
OpenText TrimEnd
PadLeft TrimStart
PadRight Write
Peek WriteLine

 


 

Debug.Write

 

What is the difference between Debug.Write and Debug.WriteLine?

 

Debug.WriteLine displays each result in a new line while Debug.Write displays all the results on one line without spaces.

 

Back to Top


 

Debug.WriteLine

 

Purpose:

Is used to display a message in the Output window while a procedure is being processed by the computer.  If the message is a container, the contents thereof will be displayed.

 

Syntax:

Debug.WriteLine(message)

 

message:  can be a literal constant, e.g. "Hello" or "5"

             can be the name of a variable, object or constant, e.g sngSales, objTextBox, conTax

 

Example:

 

To display the contents of the variable sngNumber in the Output window

Debug.WriteLine(sngNumber)

 

Back to Top


 

Focus

 

Allows you to shift the focus to a specified control (make an inactive control active) while the program is running.

 

Syntax:

 

   

[Me.]object.Focus()

 

  Me. Optional, refers to a form-level object  
  object Is the name of the control object, e.g a button, to which you want to give focus
  Focus Method name  

 

Back to Top


 

SelectAll

 

Is used to select (highlight) all the text contained in a textbox.  Text will only be selected if the textbox has the focus, so use it in conjunction with the Focus method for best results.

 

Syntax:

 

   

[Me.]textbox.SelectAll()

 

  Me. Optional, refers to a form-level object  
  textbox Is the name of the textbox where the text appears that you wish to select (highlight)
  SelectAll Method name  

 

Back to Top


 

SetBounds

 

Is used to change the location and/or size of a control while the program is running.

 

Syntax:

 

   

control.SetBounds(x, y, width, height, specified)

 

  control Is the name of the control object, e.g a button, whose size/location you want to change  
  SetBounds Method name  
  x Specifies the location of the left edge of the control on the Windows Form - a zero value means no change Together they are referred to as the Location
  y Specifies the location of the top edge of the control on the Windows Form - a zero value means no change
       
  width Sets the width of the control - a zero value means no change Together they are referred to as the Size
  height Sets the height of the control - a zero value means no change
  specified Is an intrinsic constant that specifies the arguments in the method (see the Arguments list below).  

 

Arguments list:

 

BoundsSpecified.None - No arguments are specified
BoundsSpecified.All - All arguments are specified
BoundsSpecified.Location - Both X and Y arguments are specified
BoundsSpecified.Size - Both width and height arguments are specified
BoundsSpecified.X - Specifies left argument
BoundsSpecified.Y - Specifies top argument
BoundsSpecified.Width - Specifies width argument
BoundsSpecified.Height - Specifies height argument

 

Tips:

 

* The values contained in the x, y, width and height elements can be numerical variables, e.g intValue or numerical constants, e.g conMove or plain numbers, e.g 6.
* Arguments can be used in conjunction with logical operators, e.g "BoundsSpecified.X Or BoundsSpecified.Width" or "BoundsSpecified.Y AndElse BoundsSpecified.Height"

 

Examples:

 

Notice the effect of using two different arguments for the same statement:

 

Me.FruitPictureBox.SetBounds(35, 60, 0, 0, BoundsSpecified.Location) -- The picturebox is placed 35 pixels from the left edge of the form and 60 pixels from the top edge of the form, but the size remains unchanged

 

Me.FruitPictureBox.SetBounds(35, 60, 0, 0, BoundsSpecified.All) -- The picturebox is placed 35 pixels from the left edge of the form and 60 pixels from the top edge of the form.  The width and height is adjusted to zero pixels

 

Using a numerical variable in the SetBounds method:

 

The counter (intCount) in the For...Next loop controls the value of the x argument (x refers to left) in the SetBounds method.  The counter increases with every loop which results in the picturebox's x argument being increased accordingly - the visible effect will be that the picturebox moves 5 pixels away from the left edge of the form with every loop.

 

Dim intCount As Integer

For intCount = 0 To 275 Step 5

Me.FruitPictureBox.SetBounds(intCount, 0, 0, 0, BoundsSpecified.X)

Next intX

 

Back to Top


 

 


All content on this site is free for private use only  |  Contributions are encouraged  |  Thank you to Netfirms for the free hosting  |  If copyright content is published here or links to certain content violates some right/law, contact the Webmaster to have it removed immediately.

 

Site launched: October 2005  |  Updated: July 20, 2006  |  Link exchange  |  Site map  |  Contact us