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
  • ASCII Printable Characters Only

    data-structures help question
    4
    0 Votes
    4 Posts
    0 Views
    Richard DeemingR
    If you're using VB.NET, you can use the IndexOfAny method of the String: C#: string s1 = "HELP ME, PLEASE!"; string s2 = " SXPT"; int i = s1.IndexOfAny(s2.ToCharArray()); if (i == -1) Console.WriteLine("Characters not found!"); else Console.WriteLine("Characters found at position {0}", i); VB.NET: Dim s1 As String = "HELP ME, PLEASE!" Dim s2 As String = " SXPT" Dim i As Integer = s1.IndexOfAny(s2.ToCharArray()) If i = -1 Then Console.WriteLine("Characters not found!") Else Console.WriteLine("Characters found at position {0}", i) End If In VB6, you would have to fake it: Dim s1 As String : s1 = "HELP ME, PLEASE!" Dim s2 As String : s2 = " SXPT" Dim i As Integer Dim index As Integer Dim found As Boolean : found = False For i = 1 To Len(s2) index = InStr(1, s1, Mid(s2, i, 1) If index > 0 Then found = True Exit For End If Next If Not found Then Debug.Print "Characters not found!" Else Debug.Print "Characters found at position " & index End If
  • FindFirstFile

    question
    2
    0 Votes
    2 Posts
    0 Views
    B
    File_Name = Dir$(File_Path, vbDirectory) Do While File_Name <> "" If File_Name <> "." And File_Name <> ".." Then ..... Your statements go here ..... End If Loop This way i avoided the first two cases:) Thanks & Regards, Bhaskar.G
  • Copying controls

    help question workspace
    4
    0 Votes
    4 Posts
    1 Views
    A
    Alright yeah i see your point. Well instead of copying the controls can i simply add them sequentially and do something similar to what the dude is doing with the buttons in the post i have mentioned *phew* ?
  • Changing Textbox Background color upon gaining focus

    question help tutorial
    3
    0 Votes
    3 Posts
    0 Views
    L
    Opps, sorry. Stealing bandwidth here. Here's what I found... Double click in the control. Delete the function the IDE creates. Select the "GotFocus" command in the right hand drophand list box in the IDE. A new function will appear. Type in: ctrlName.BackColor = {{valid color code}} Thanks anyway.
  • Link Error 8577

    help database question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • Moving Data From VB --> MFC DLL

    c++ hardware help question
    2
    0 Votes
    2 Posts
    0 Views
    A
    You can pass the actual pointer of your vb structure to the C Dll using the ByRef flag which is declared on your parameters of the Public Function...Lib..Alias...(ByRef mystruct as MYSTRUCT) hook in vb. You can then use the pointer to modify the contents in the dll and vb SHOULD be ok with it. However there are problems with it, especially surrounding MODIFICATION of strings in the dll since vb uses BSTR's (a unicode string that can ignore null terminators) and I bet that your dll uses LPSTR's which are non unicode (which is perfectly acceptable). VB should convert them to BSTR's but I have encountered fiddly problems with it that tested my patience :). Alan. "When I left you I was but the learner, now I am the master" - Darth Vader
  • how we can refresh reports in Data Report

    2
    0 Votes
    2 Posts
    0 Views
    A
    You need to requery the data through the data environment. However, I have found this to be a nightmare (and in general vb), thats why I'm online..trying to find a better approach(besides writing a C dll that does the job cos it would take a while). Why is Visual Basic so pants? "When I left you I was but the learner, now I am the master" - Darth Vader
  • Specified cast is not valid

    help question
    2
    0 Votes
    2 Posts
    0 Views
    Z
    I figure out the problem. I am using DriveListBox and in the same time using a function to populate the DriveListBox combobox. I eliminated the FinDAllDrives and woolaaa. Thanks.;) Zulfikar Ali
  • mirc chat window text

    json lounge
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • VB.NET and Function Points

    question csharp
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • PDF File Merge

    question help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • vb.net Drive & Folder tree object required

    data-structures csharp help
    3
    0 Votes
    3 Posts
    0 Views
    Z
    Check this link. A good example of using dirListBox, DriveListBox in VB .NET. Very easy to implement. Cheers http://www.dotnetjunkies.net/tutorials.aspx?tutorialid=392:-D Zulfikar Ali
  • how to simulate an animal's random movement

    tutorial question lounge
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Null handling

    database question
    4
    0 Votes
    4 Posts
    0 Views
    N
    Rulle wrote: I wounder how null values from a database can be handled in VB 6/ADO You can check the value of something being returned from the recordset with isnull(adors("someField")). :) Nick Parker **The goal of Computer Science is to build something that will last at least until we've finished building it. - Unknown **
  • New MSDN article (flaw?)

    csharp css data-structures performance
    3
    0 Votes
    3 Posts
    0 Views
    D
    Ray Cassick wrote: An array of objects is faster if you always traverse it sequentially. For random access, an array can be slightly faster. Correction: Collections are usually implemented using linked lists. Both linked lists and arrays provide fast sequential access. But for random access, arrays are faster. "In an organization, each person rises to the level of his own incompetence." Peter's Principle
  • Ranges in Excel

    help
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • prob in calling crystel report from vb.net

    help csharp design
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Error BC30311. Can't convert

    help database question
    3
    0 Votes
    3 Posts
    0 Views
    S
    I've already try this. I even deleted all file named as my DLL and it's still not working :((
  • start page

    csharp visual-studio tools performance help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied