Skip to content

Visual Basic

Visual Basic Questions

This category can be followed from the open social web via the handle visual-basic@forum.codeproject.com

34.4k Topics 120.1k Posts
  • How to create charts via VB??

    performance help tutorial question
    2
    0 Votes
    2 Posts
    11 Views
    L
    An plugin of AAA EasyGrid ActiveX will be very helpful. It can be downloaded from http://www.share2.com/easygrid/
  • creatiing a login screen

    help database tutorial question
    2
    0 Votes
    2 Posts
    8 Views
    L
    Hopefully it helps :-D :-D Private Sub cmdOK_Click() 1 Dim CNN As New ADODB.Connection 2 Dim RCS As New ADODB.Recordset 3 Dim CNNstr As String 4 Dim sqlstr As String 5 Open App.Path + "\" + "db\CNNstr.txt" For Input As #1 6 Input #1, CNNstr 7 Close #1 8 CNN.CursorLocation = adUseClient 9 CNN.Open CNNstr 10 sqlstr = "select * from TABLE where UserID = '" & Text1.Text & "' and UserPassword ='" & Password & "'" 11 RCS.Open sqlstr, CNN, adOpenForwardOnly, adLockReadOnly 12 If RCS.RecordCount > 0 Then 13 Form1.Show 1 14 Else 15 r = MsgBox("Unauthorised User") 16 Text1.SetFocus 17 End If End Sub 1, 2, 3, 4 Declare variable 5 get the database path in text file 10 check whether the user exist and the password correct or not at once
  • Passing in variables to a VB executable

    c++ question
    2
    0 Votes
    2 Posts
    10 Views
    A
    Taken from MSDN: Function GetCommandLine(Optional MaxArgs) 'Declare variables. Dim C, CmdLine, CmdLnLen, InArg, I, NumArgs 'See if MaxArgs was provided. If IsMissing(MaxArgs) Then MaxArgs = 10 'Make array of the correct size. ReDim ArgArray(MaxArgs) NumArgs = 0: InArg = False 'Get command line arguments. CmdLine = Command() CmdLnLen = Len(CmdLine) 'Go thru command line one character 'at a time. For I = 1 To CmdLnLen C = Mid(CmdLine, I, 1) 'Test for space or tab. If (C <> " " And C <> vbTab) Then 'Neither space nor tab. 'Test if already in argument. If Not InArg Then 'New argument begins. 'Test for too many arguments. If NumArgs = MaxArgs Then Exit For NumArgs = NumArgs + 1 InArg = True End If 'Concatenate character to current argument. ArgArray(NumArgs) = ArgArray(NumArgs) & C Else 'Found a space or tab. 'Set InArg flag to False. InArg = False End If Next I 'Resize array just enough to hold arguments. ReDim Preserve ArgArray(NumArgs) 'Return Array in Function name. GetCommandLine = ArgArray() End Function If you need help changing this code around to fit your needs, just reply. Basically everything in the command line gets passed in by the Command Function.
  • deploiying an access project

    tools database help question
    2
    0 Votes
    2 Posts
    8 Views
    L
    If you have the Office Developer Edition with MS Access you can use their Setup WIzard wich creates disk images for you as well as bringing together all (not 100%) the referenced stuff. This is the easiest way but not always problem free. If you used API functions in your code this setup program will not recognise them and you must somehow ensure that the API source files get on to the computer you are deploying to. Benefit of the Developer addition is that you get a runtime version of MS Access which adds greater security and behaves more like a standalone exe application (but there are enough querks to let you now it's not an exe). Also there are heaps of bugs relating to system folers being used as the location of your runtime application for some reason C:\My Documents\myMDE.mde /Runtime can stuff up so don't deploy in this folder. The Hard Way Use the object browser to view the libraries you have referenced also use the reference/cotrol lists and record all the dll, ocx, and every other file you referenced as well as it's path. Once you have done that collect all of them and write a program (or do it manually) that copies them to their original folders (dangerous do not overwrite newer versions). Sux ha. The reason it's hard to deploy is that no one actually expected VB programmers to achieve anything, you know, we are seen as the "Wanna be programmers." and as such the part of getting your app distributed hits those software manufactures as big news .....bigger than a newspaper front page article ...."Whore becomes Christian" or "Christian WOman Becomes WHore", either way it wasn't ment to be.
  • Creating Sub Properties in ActiveX Control

    com data-structures tutorial
    2
    0 Votes
    2 Posts
    11 Views
    L
    i think you mean something like this in class, MyActiveXControl Private m_sStringProperty as String ... Public Property Get MyStringProperty() as String      MyStringProperty = m_sStringProperty End Property Public Property Let MyStringProperty(sSP as String)      ' Validate if you want      m_sStringProperty = MyStringProperty End Property You can also use 'Public Property Set' to have an object be a property and you can use Private to make your property read/write only as well. James Johnson -- There are two secrets to success. 1) Never tell anyone everything you know.
  • Getting the Caret Location

    question
    8
    0 Votes
    8 Posts
    31 Views
    J
    Yes, OK - throw it my way (jteagle@ntlworld.com). Tomorrow I can then take a look and see if I can spot anything (I'm on UK time). No guarantees though.
  • Resolotuin Change!

    2
    0 Votes
    2 Posts
    12 Views
    L
    Try the ChangeDisplaySettings API function
  • VB

    4
    0 Votes
    4 Posts
    23 Views
    L
    cool !
  • Vb programming, Tree view control

    question data-structures
    2
    0 Votes
    2 Posts
    8 Views
    M
    Use the split function to get the variant array of the values entered in the textbox.the child nodes can be added for the existing child node by using this array.
  • General System Information

    sysadmin lounge
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • context sensitive help to bookmark

    html help tutorial question
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • Tab control & Form

    design tutorial question
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • Code for save

    2
    0 Votes
    2 Posts
    8 Views
    B
    Here's one way... Sub SaveDocToFile() ' Replace "Any.Doc" with your document name ' type with or without path you want to save it to Dim strSaveAs As String Dim strMsg As String strSaveAs = "Any.Doc" strMsg = "Choose Yes to overwrite the existing document " & vbCrLf _ & "'" & strSaveAs & "'" & " or No to save as a new document" If Dir(strSaveAs & "*") = "" Then ActiveDocument.SaveAs FileName:=strSaveAs Else Select Case MsgBox(strMsg, vbYesNoCancel + vbExclamation) Case vbYes ActiveDocument.SaveAs FileName:=strSaveAs Case vbNo With Dialogs(wdDialogFileSaveAs) .Name = "" .Show End With Case Else End Select End If End Sub
  • VBA Code Pause

    linux question
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • running task

    linux tutorial question
    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • append a file with DoCmd.TransferText

    3
    0 Votes
    3 Posts
    12 Views
    L
    Thanks Giles
  • Inet and upload file ??

    sysadmin question
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • Launch MS Word and open file

    tutorial question
    3
    0 Votes
    3 Posts
    15 Views
    L
    Dim word As New word.Application Set objWrd = CreateObject("word.application") word.Visible = True word.Documents.Open filename:=File It's better like this :-D
  • VB SQL Connectivity through Internet.

    question database sql-server sysadmin
    3
    0 Votes
    3 Posts
    11 Views
    J
    You need to make sure that the SQL Server is set up to use TCP\IP protocol and then on your client machines in the setup of the DSN you need to make sure they are trying to connect via TCP and not Named Pipes (which would only work in you intranet). Jason Cono, MCSD
  • Calling Extension DLLs from VB or MATLAB

    csharp c++ visual-studio
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied