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
  • database question

    database help question learning
    5
    0 Votes
    5 Posts
    0 Views
    S
    Will give it a try... Thanks I was born intelligent Education ruined me!.
  • Creating RGN of form

    question csharp
    5
    0 Votes
    5 Posts
    0 Views
    T
    THANK YOU regards Best Regards Emre YAZICI
  • Access Form question

    help linux question career
    2
    0 Votes
    2 Posts
    0 Views
    D
    The problem is the spaces, your right. But solution is also pretty easy. The problem comes because the spaces are seen as command-line argument seperators. This is the command-line your sending to Shell: D:\...\wmplayer.exe g:\mp3\045- mp3\test.mp3 Your actually telling wmplayer that there are 2 command-line parameters: 'g:\mp3\045-' and 'mp3\test.mp3' The solution is to put quotes around both parts of the command-line: PlayFullName = chr$(34) & "G:\MP3\045- Mp3\test.mp3" & chr$(34) stAppName = chr$(34) & "D:\Program Files\Windows Media Player\wmplayer.exe" & chr$(34) & " " & PlayFullName Now your sending the command-line as: "D:\...\wmplayer.exe" "G:\mp3\045- mp3\test.mp3" The quotes will prevent the spaces from becoming argument seperators. RageInTheMachine9532
  • Printer Pool and WshNetwork

    csharp dotnet sysadmin
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • FileSystemWatcher

    question
    3
    0 Votes
    3 Posts
    0 Views
    Z
    Thanks for your reply. But folders can't be sub folder in my project. Anyway i have figured out the solution. Here is the code if anybody is interested. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim i As Integer Dim strName As String Dim strDBReject As String Dim strParseReject As String 'Load the profile info from the setup XML file Dim dsGetIni As New DataSet() dsGetIni.ReadXml(Application.StartupPath & "\setup.xml") Dim dtGetIni As DataTable = dsGetIni.Tables("Profile") i = dtGetIni.Rows.Count Dim objRow As DataRow() For i = 0 To dsGetIni.Tables("Profile").Rows.Count - 1 strName = dtGetIni.Rows(i)("Name") strDBReject = dtGetIni.Rows(i)("DBReject") watcher(strDBReject) strParseReject = dtGetIni.Rows(i)("ParseReject") watcher(strParseReject) Next End Sub Public Function watcher(ByVal strFolder As String) Dim objWatcher As New System.IO.FileSystemWatcher() 'Folder to watch objWatcher.Path = strFolder 'File extension to watch objWatcher.Filter = "*.pdf" 'Create delegates to handle the events for the FileSystemWatcher AddHandler objWatcher.Created, AddressOf OnFileCreated 'Exclude subdirectories from watching objWatcher.IncludeSubdirectories = True 'Start watching folder objWatcher.EnableRaisingEvents = True End Function Public Sub OnFileCreated(ByVal source As Object, ByVal e As System.IO.FileSystemEventArgs) Try 'create new instance of importer Dim FileInfo As New FileInformation(e.FullPath) ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf ProcessFile), FileInfo) Catch ex As Exception End Try End Sub Private Function GetExclusiveAccess(ByVal FilePath As String) As Boolean Try Dim theFile As File Dim strm As Stream = theFile.Open(FilePath, FileMode.Open) 'if we succeed, we can let it go strm.Close() GetExclusiveAccess = True Catch e As Exception GetExclusiveAccess = False End Try End Function Public Sub ProcessFile(ByVal fileInfo As Object) If Thread.CurrentThread.Name = "" Then Thread.CurrentThread.Name = Thread.CurrentThread.GetHa
  • DataGrid Problem/Question

    question css help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • IDM_SHVIEW_NEWFOLDER Usage in Web Browser control

    help json
    3
    0 Votes
    3 Posts
    0 Views
    V
    Hello, Thank you for your early help. :) I had gone through that web page earlier. But i don't think so it will help me in solving my problem. Could you suggest me another solution? Regards, Vilas Shewale ;)
  • Is the logged on user an administrator?

    question csharp com
    2
    0 Votes
    2 Posts
    0 Views
    Richard DeemingR
    Try something like: Imports System.Security.Principal ... Dim identity As WindowsIdentity = WindowsIdentity.GetCurrent() Dim principal As New WindowsPrincipal(identity) Dim isAdmin As Boolean = principal.IsInRole(WindowsBuiltInRole.Administrator) "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • Windows DataGrid Control Column Formatting

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Very basic question

    question database help learning
    3
    0 Votes
    3 Posts
    0 Views
    S
    jdunlap wrote: Did you add Microsoft ActiveX Data Objects to your references? Ahhh!! I didnt do it... Thanks.... I was born intelligent Education ruined me!.
  • VB Endian Conversion

    csharp c++ tutorial question
    5
    0 Votes
    5 Posts
    9 Views
    J
    Glad you like them! That is the cByteFns class from my Data dll. Do unto others as you would have them do unto you - Jesus An eye for an eye only makes the whole world blind - Mahatma Gandhi
  • RichtextBox Control

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Use DLL in VBasic

    question c++ help
    12
    0 Votes
    12 Posts
    0 Views
    R
    This is kind of lengthy... but this is how i do it. First, create a dll project in vcc. Select MFC AppWizard(DLL). Select Regular DLL. Does'nt matter whether MFC is static or shared. Create a .cpp file for your function you want to call. You will have to create "C" style function because you cannot do external linkage to vb with C++ classes. This example is a function called Function123. It takes a string you can modify and returns a UINT. prototype: extern "C" UINT __stdcall Function123 (LPSTR lpszBenefits); the body looks like this: extern "C" UINT __stdcall Function123(LPSTR lpszBenefits) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); // This line is important!!! // do something return someUINT; } Now find the .def file that vc created. It should be under source files where the rest of the cpp files are. Add the following entry to the file: Function123 @1 The @1 indicates that this is function #1 to be exported. If you add more functions then they should be as @2,@3 etc. Compile your project and produce the DLL. Now, in VB: Add this line at the top of a module file: Private Declare Function vbfunctionname Lib "EChartPatients.dll" Alias "Function123" (ByVal strName As String) As Long Now in your module to use this function: ... dim x as integer dim y as string x= vbfunctionname(y) ... The DLL you created does not have to be linked to the vb exe in any way except that it has to be in the executable path, or, you have to hardcode the path + name in the vb declare statement. Warning: Initialize your vb string to the max length required prior to sending it into the dll.
  • Help.......

    help tutorial question
    2
    0 Votes
    2 Posts
    0 Views
    N
    Fleischen wrote: How do Change the location of, for example a textbox? I Know u Can do it when you place the textbox. But if you wat to do it during runtime, how do u do it? Change the .Left and .Top values. -Nick Parker
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • VB 2 VB.NET

    csharp question
    4
    0 Votes
    4 Posts
    1 Views
    O
    Ok thanks Mikasa, I found it in MSDN. Regards "On the 8th day, God started debugging"
  • Lazy Evaluation ternary op?

    java question announcement
    5
    0 Votes
    5 Posts
    0 Views
    M
    Yes, True! I wonder if there is a better way to accomplish what I was explaining previously??
  • Access Visual Basic References

    help database question announcement
    2
    0 Votes
    2 Posts
    0 Views
    M
    No, your best best is to Code using "Late Binding" methods. All you have to do is get rid of your References when you are sure that the Code works, then Change every Variable to Type "Object". This way it will work no matter what Version of MS Office plus you can trap Errors to determine if Office is not installed. For example: On Error Goto ErrHandler Dim xlApp As Excel.Application 'Error will Occur here when not installed Set xlApp = New Excel.Application ErrHandler: If (Err.Number <> 0) Then 'Of course, determine the Correct Error Number for this... MsgBox "Excel is not Installed!" End If Now, change it to this after removing all References to Excel: On Error Goto ErrHandler Dim xlApp As Object Set xlApp = CreateObject("Excel.Application") 'Error will Occur here when not installed ErrHandler: If (Err.Number <> 0) Then 'Of course, determine the Correct Error Number for this... MsgBox "Excel is not Installed!" End If
  • VB6 code in VB7?

    csharp c++ asp-net question
    5
    0 Votes
    5 Posts
    0 Views
    D
    Rickard Andersson wrote: okay, I was wondering because my school will give me VB6 very soon, but I already own VS.NET so I don't want to install VB6 unnecessarily! Then, you have asked the wrong question; the correct is: can VB.NET code be compiled on VB6? And the answer is no. It's not the fall that kills you: it's the sudden stop - Down by Law, Jim Jamursch (1986)
  • PrintPreview Question 2

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied