Question about Microsoft Visual Studio 2005 Standard Edition for PC

1 Answer

What does Dim, Try , Me , Private Sub means in Visual Basic

Posted by on

Ad

1 Answer

  • Level 1:

    An expert who has achieved level 1.

    Mayor:

    An expert whose answer got voted for 2 times.

    Problem Solver:

    An expert who has answered 5 questions.

  • Contributor
  • 6 Answers

Dim allows you to declare a variable. It is short for "Dimension", and is an old old keyword. For example if you want to declare a variable called i that can hold an integer you would write:
Dim i As Integer
The Try keyword is used to allow you catch errors when they occur. If you didn't catch them, they would cause the program to end with an error report.
Try ' Code goes in here that might throw an error Catch Ex As Exception ' Code goes here to deal with any error End Try
The Me keyword refers to the current instance of the class in which the word appears. For example if the class is called Form1, then Me allows you to refer to the current instance of the class when the code is running.
Private Sub is formed from two Keywords. Private is an "Access modifier". When applied to a Sub it means that the Sub would not be visible outside the class. Sub is short for "Subroutine". A subroutine is a section of code that performs some useful function that you might want to run many times. For example you might want to do something whenever a button is clicked, and so you would write a subroutine with code in that will run whenever the button is clicked.
It would be better to ask programming questions in a visual basic forum. There are many on the internet. Search the internet for "visual basic forum". Also note that when you are using Visual Studio 2005, you can press the F1 key when you have placed the cursor in a word that you do not understand, and it will open the help and the relevant page.
These terms are very very difficult to understand when you have never programmed before. Usually it is best to take a lot of it on faith, and move on through the book or example that you are following without completely understanding it all. Over time, with practice, repetition and perseverance you will start to develop an understanding of the underlying concepts. They are hard to explain and hard to learn.

Posted on Jun 13, 2010

Ad

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Ad

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

Using while loop you have to show the numbers you entered to be the the reverse output of it Ex. 1734 will output 4371


Dim n,t as Integer
Private sub cmd_click()
t=0
n=val(txtnum.Text)
while n>0
t=t+(n%10)
n=n/10
End While
lbl.Caption=n

Feb 27, 2011 | Microsoft Visual Basic 6.0 for PC

1 Answer

How to read and write to registry


.NET code.

It is very simple all you need is.
Imports Microsoft.Win32
Public Class Form1
Dim reg As RegistryKey = Registry.LocalMachine.CreateSubKey("Software\MyApp\", RegistryKeyPermissionCheck.ReadWriteSubTree)
Dim regKey As RegistryKey = Registry.LocalMachine.OpenSubKey("Software\MyApp\", True)

Private Sub SetBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetBtn.Click
regKey.SetValue("KeyName", "Path")
End Sub

Private Sub GetBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetBtn.Click
Dim Path As String
Path = regKey.GetValue("KeyName")
End Sub
End Class





Jun 23, 2009 | Microsoft Visual Basic Enterprise Edition...

1 Answer

Flexgrid with textbox


The arrow key will place you into the cell of your choice. In code you can determine the cell you are in by using the "Col" and "Row" properties. Here's a snippet for you:

Private Sub MSFlexGrid1_RowColChange()
Dim intCol As Integer
Dim intRow As Integer

intCol = MSFlexGrid1.Col
intRow = MSFlexGrid1.Row

Text1.Text = CStr(intCol) & " ; " & CStr(intRow)

End Sub

Mar 29, 2009 | Microsoft Visual Basic 6.0 for PC

1 Answer

Can i ask example of vasual basic 6.0?


Do you need a random example?
If you're looking for a specific case please let us know.

Please find below your random example:

Dim mark As Single

Private Sub Compute_Click()

'Examination Marks
mark = mrk.Text

Select Case mark
Case 0 to 49

comment.Caption = "Need to work harder"

Case 50 to 59

comment.Caption = "Average"

Case 60 to 69
comment.Caption = "Above Average"

Case 70 to 84
comment.Caption = "Good"

Case Else
comment.Caption = "Excellence"

End Select

End Sub




Mar 19, 2009 | Microsoft Visual Basic 6.0 for PC

1 Answer

An example of visual basic program


Visual Basic (VB) is the thrid generation event-driven programming language and integrated development enviorment (IDE) from Microsoft for its COMprogramming model. VB is also considered a relatively easy to learn anduse programming language, because of its graphical development featuresand BASIC heritage.
Here is an example of a code that displays a message box "Hello, World!"
as the program runs:

Private
Sub Form_Load()
MsgBox "Hello, World!"
End Sub

simply making duplicated lines of text and changing the words in the
speech marks can draw a different text and ammounts.
For example:

Private
Sub Form_Load()
MsgBox "Welcome, blue_skies61!"
MsgBox "My name is Siwek06!"
End Sub

you can also bold the text by puting this line before a text:

Sub SetFontBold()

Overall i think this is a easy language to learn.
Go on to microsoft.com help center, or the forums to learn more.


Feb 23, 2009 | Visual Land V-Touch Digital Media Player

2 Answers

Hw to link database using visual basic


use adobc <------try this

dim rs as new adobc.recordset
dim cn as new adobc.connection

private sub xn()
cn.cursorlocation = aduseclient
cn.open "CONNECTION STRING" <------
end sub

private sub form_load()
call xn
if rs.state=adstateopen then rs.close
rs.open "select * from TABLENAME" ,cn, adlockstatic, adlockreadonly
if rs.recordcount > 0 then
set datagrid1.datasource = rs
end sub

Feb 12, 2009 | Microsoft Visual Basic 6.0 for PC

1 Answer

What is the program code to shutdown the pc in visual basic


I was wondering if someone could help me to convert this vb6 code to be used
in VB.net. It basically allows you to call the subs at the bottom to logoff
shutdown and restart the pc (By force if necessary). Any help is greatly
appreciated.

Private Const EWX_LOGOFF = 0
Private Const EWX_SHUTDOWN = 1
Private Const EWX_REBOOT = 2
Private Const EWX_FORCE = 4
Private Const TOKEN_ADJUST_PRIVILEGES = &H20
Private Const TOKEN_QUERY = &H8
Private Const SE_PRIVILEGE_ENABLED = &H2
Private Const ANYSIZE_ARRAY = 1
Private Const VER_PLATFORM_WIN32_NT = 2

Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type

Public Type LUID
LowPart As Long
HighPart As Long
End Type

Public Type LUID_AND_ATTRIBUTES
pLuid As LUID
Attributes As Long
End Type

Public Type TOKEN_PRIVILEGES
PrivilegeCount As Long
Privileges(ANYSIZE_ARRAY) As LUID_AND_ATTRIBUTES
End Type

Private Declare Function GetCurrentProcess Lib "kernel32.dll" () As Long
Private Declare Function OpenProcessToken Lib "advapi32.dll" (ByVal
ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As
Long
Private Declare Function LookupPrivilegeValue Lib "advapi32.dll" Alias
"LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As
String, lpLuid As LUID) As Long
Private Declare Function AdjustTokenPrivileges Lib "advapi32.dll" (ByVal
TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As
TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As
TOKEN_PRIVILEGES, ReturnLength As Long) As Long
Private Declare Function ExitWindowsEx Lib "user32.dll" (ByVal uFlags As
Long, ByVal dwReserved As Long) As Long
Private Declare Function GetVersionEx Lib "kernel32.dll" Alias
"GetVersionExA" (ByRef lpVersionInformation As OSVERSIONINFO) As Long

Private Sub EnableShutDown()
Dim hProc As Long
Dim hToken As Long
Dim mLUID As LUID
Dim mPriv As TOKEN_PRIVILEGES
Dim mNewPriv As TOKEN_PRIVILEGES

hProc = GetCurrentProcess()
OpenProcessToken hProc, TOKEN_ADJUST_PRIVILEGES + TOKEN_QUERY, hToken
LookupPrivilegeValue "", "SeShutdownPrivilege", mLUID
mPriv.PrivilegeCount = 1
mPriv.Privileges(0).Attributes = SE_PRIVILEGE_ENABLED
mPriv.Privileges(0).pLuid = mLUID
AdjustTokenPrivileges hToken, False, mPriv, 4 + (12 *
mPriv.PrivilegeCount), mNewPriv, 4 + (12 * mNewPriv.PrivilegeCount)
End Sub

Public Sub ShutDownNT(Force As Boolean)
Dim Ret As Long
Dim flags As Long

flags = EWX_SHUTDOWN
If Force Then flags = flags + EWX_FORCE
EnableShutDown
ExitWindowsEx flags, 0
End Sub

Public Sub RebootNT(Force As Boolean)
Dim Ret As Long
Dim flags As Long

flags = EWX_REBOOT
If Force Then flags = flags + EWX_FORCE
EnableShutDown
ExitWindowsEx flags, 0
End Sub

Public Sub LogOffNT(Force As Boolean)
Dim Ret As Long
Dim flags As Long

flags = EWX_LOGOFF
If Force Then flags = flags + EWX_FORCE
ExitWindowsEx flags, 0
End Sub

Jan 01, 2009 | Microsoft Windows XP Professional With...

1 Answer

I have a runtime error 9 subscript out of range, when i try to open a program


  1. Start the Visual Basic Editor (press ALT+F11).
  2. If Project Explorer is not visible, press CTRL+R to activate Project Explorer.
  3. Click to select the Visual Basic project that contains the module sheet that you want to copy.
  4. On the Tools menu, click References. Click to select the Microsoft Visual Basic for Applications Extensibility 5.3 check box, and then click OK.
  5. Click Module on the Insert menu.
  6. Type the following code into the module sheet: Sub CopyModule() Dim CodeLines As String Dim ModuleToCopy As VBComponent Dim NewModule As VBComponent ' Set a variable to the module to copy. ' Note: This assumes that the name of the module to copy is ' "module2". Replace "Module2" with the name of the module to copy. Set ModuleToCopy = _ Application.VBE.ActiveVBProject.VBComponents("module2") ' Get the Visual Basic code from the module. CodeLines = ModuleToCopy.CodeModule.Lines _ (1, ModuleToCopy.CodeModule.CountOfLines) ' Create a module sheet in another workbook. ' Note: You must refer to the name of the Visual Basic project. By ' default, the name of all new projects is "VBAProject". You may want ' to rename the project to which you are copying the contents of the ' module sheet. Set NewModule = Application.VBE.VBProjects("VBAProject") _ .VBComponents.Add(vbext_ct_StdModule) ' Add the Visual Basic code to the new module. NewModule.CodeModule.AddFromString CodeLines ' Rename the new module to the name of the previous module. NewModule.Name = ModuleToCopy.Name End Sub
  7. Run the CopyModule procedure.

Regards

Samson Ved

Dec 05, 2008 | Computers & Internet

1 Answer

Visual basic


What exactly do you want to do?

There are a lot of ways...one easy way is to control the mplayer app. This is a VBS script...

WshShell.Run "wmplayer.exe"
Setup a Scripting File System Object like "set oFSO=createobject("scripting.filesystemobject")"

Then use "WshShell.SendKeys" to send the keystrokes to the player

Another way is...

To embed the media then use Active X calls, which would requie visual basic.
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
Const DATA_FILE_EXTENSION As String = ".mp3"
Dim dlgFileDialog As New OpenFileDialog
With dlgFileDialog
.Filter = DATA_FILE_EXTENSION & _
" files (*" & DATA_FILE_EXTENSION & "|*" & DATA_FILE_EXTENSION
.FilterIndex = 1
.RestoreDirectory = True
If .ShowDialog() = DialogResult.OK Then
'Play the sound file
Me.AxWindowsMediaPlayer1.URL = dlgFileDialog.FileName
End If
End With
End Sub

Sep 10, 2008 | Computers & Internet

1 Answer

VISUAL BACSIC 6.0


Using ActiveX Components in Visual Basic 6.0

' Dim as New:
Dim ftp As New ChilkatFtp2

' Alternatively, Dim and instantiate later:
Dim x as ChilkatFtp2
Set x = New ChilkatFtp2
' Note: The WithEvents can only appear in the declaration
' section of a module, and cannot be local to a procedure.
' Also, it cannot be used with the "New" keyword.
' The object creation must occur in a separate step, typically
' in the Form load.
Dim WithEvents ftp As ChilkatFtp2
Private Sub Form_Load()
Set ftp = New ChilkatFtp2
End Sub
Private Sub ftp_AbortCheck(abort As Long)
End Sub
Private Sub ftp_PutProgress(ByVal pctDone As Long)
End Sub

Aug 21, 2008 | Computers & Internet

Not finding what you are looking for?
Microsoft Visual Studio 2005 Standard Edition for PC Logo

774 people viewed this question

Ask a Question

Usually answered in minutes!

Top Microsoft Computers & Internet Experts

micky dee

Level 3 Expert

2767 Answers

Piyal Perera
Piyal Perera

Level 3 Expert

528 Answers

Les Dickinson
Les Dickinson

Level 3 Expert

18394 Answers

Are you a Microsoft Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...