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
  • String to button?????

    csharp help tutorial question
    2
    0 Votes
    2 Posts
    0 Views
    C
    ...shot in the dark, just add them to a collection: dim mCollection as new collection mCollection.add Button1, Button1.Name ' Add the object using its name as a key mCollection.add Button2, Button2.Name ' Add another button mCollection.item("Form1.Button1").Enabled = false ' Disable button1 See? I hope this is a clear enough example. You could get complex with a type safe collection which only accepts controls or you could maybe have a class which inherits from a control container and that might give you additional functionality, but this suggestion is low down dirty and should work. Chris. Nursey
  • Print All - ICON

    question
    2
    0 Votes
    2 Posts
    0 Views
    I
    (Wrong forum BTW, but never mind :-)) Well, given that the save all icon is a "stacked" set of disks, why not stack a load of printers? :-) Also, try Google (Advanced) Image Search -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
  • 0 Votes
    3 Posts
    0 Views
    C
    OK, I have 4 controls, 4 bitmaps all 16x16 using 16 color palette. Two of my controls display their toolbox bitmap and two display the old cog yellow cog wheel. What the heck is going on here. Here is an example of one of my attributes. I've rebuilt the assembly, unreferenced and rerefenced it, quit the IDE and gone back in, and everything I can think of. _ Thanks. Nursey
  • Bit shifting in VB

    8
    0 Votes
    8 Posts
    0 Views
    D
    Yep, you can debug design-time code just about the same way you could under VB6. Microsoft was kind enough to supply a sample of it here[^]. RageInTheMachine9532
  • Dealing with dbnulls after joins

    database question
    2
    0 Votes
    2 Posts
    0 Views
    C
    I'd say you would be better changing the SQL to return the appropriate value: SELECT t1.c1 as t1c1, t1.c2 as t1c2, COALESCE(t2.c1, '') as t2c1, COALESCE(t2.c2, 0) as t2c2 FROM ... t2.c1 is a string t2.c2 is an integer For more information look up the index on the SQL Server 2000 books online for COALESCE --Colin Mackay-- "In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown) Enumerators in .NET: See how to customise foreach loops with C#
  • VB.Net WS_EX_LAYERED Forms

    csharp winforms question
    6
    0 Votes
    6 Posts
    0 Views
    C
    Andrew...this is a comment to you, because we all get code blindness, but the rest of us have learned a very valuable lesson from Rage, read the code brothers, be the code. I just had the urge to assume I could grab you a quick example and let you go from there. If I had read the code properly then I too would have learned somthing 8-) say la vee as people who talk foreign languages phonetically would say. Chris. Nursey
  • Shared members raising events

    help c++
    2
    0 Votes
    2 Posts
    0 Views
    C
    Dear all, I've now seen the error of my ways and produced a more elegant way, and adopted a more technically correct approach from an OO point of view. I have a polling class and a polled object interface which people can implement. They register their objects with the "poller" and it polls all registered object periodically, so I have a single timer object which can trigger events in many objects which I think gives me basically limitless resource, rather than having loads of timers running. This lets me do things like blinking buttons, if you're interested. Anyway, it will all be included in the next release of my XP buttons and docking containers release. Thanks anyway. Nursey
  • from a textbox to Excel

    help
    6
    0 Votes
    6 Posts
    0 Views
    D
    In that case, it's the SQL INSERT statement that is bad or not formated correctly. After looking up the INSERT statement on MSDN, I've found that it should look something like this: cmd.CommandText = "INSERT INTO [EmployeeData$] (ID, Name, BirthDate) values ('" & strID & "', '" & strName & "', #" & Birthdate & "#)" Where string values must be enclosed in single quotes. Date values must be passed something like #1/1/1999# (enclosed in pound signs). I haven't tested this, but it should work according to the docs. ;) You might have to make sure that the Birthdate gets passed in the correct format. RageInTheMachine9532
  • vb script/connecting to an as400 session

    question tools
    2
    0 Votes
    2 Posts
    0 Views
    D
    You'd do it the same way, but the catch is VBScript or Microsoft 'anything' doesn't come with objects standard that would do that. In your example, your using a 3rd party object to make the connection. For AS400, you'd have to use another 3rd party object, like Rumba from NetManage. RageInTheMachine9532
  • MSScriptControl and VB.Net Control Events

    csharp tools
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • How can I integrated a combobox ?

    question help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • How to Stop a Big Loop

    question tutorial
    2
    0 Votes
    2 Posts
    0 Views
    I
    You need to provide a means to break the loop. This is an example (untested), but you should get the idea: dim StopButtonPressed as Boolean sub MyLongLoopSubroutine() StopButtonPressed = false while (MyCondition = true ) and (StopButtonPressed = false) ' do loop stuff here ' DoEvents allows the UI and other windows messages to get through DoEvents wend end sub sub StopButton_Click() StopButtonPressed = true end sub Bear in mind you need to be careful when using DoEvents to keep a user interface responsive, as any actions the user has may interfere with the loop you're running. -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
  • My Computer Shell Extension

    linux tutorial
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Casting variables in VB.NET

    question csharp
    4
    0 Votes
    4 Posts
    0 Views
    J
    Thanks, that is a lot clearer. Jim
  • Visual Studio Freezing.

    csharp visual-studio winforms design testing
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Hide Folder and files

    2
    0 Votes
    2 Posts
    0 Views
    D
    How do you want to hide these files? Do you want to want to encrypt them so noone can see the contents? Do you want the files hidden in the directory, which is pretty weak security by the way...)? Need a bit more detail about what you want... RageInTheMachine9532
  • Help me to draw Icon in CheckedListBox

    help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • delimiters using VB.net

    csharp help
    5
    0 Votes
    5 Posts
    0 Views
    I
    ccandler wrote: I have broken appart the file by using the split function but now have an issue with the carriage returns. The values from the last field of the line is put with the first field of the next line? :confused: Now I'm confused. You mean that each line of the file doesn't represent a full record, and that a record can overlap lines of the file? Maybe you could provide some sample data and information about the file format? A straight CSV would be readable the way suggested. -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
  • date conversion

    help tutorial csharp question
    2
    0 Votes
    2 Posts
    0 Views
    A
    Try this: DateTime dt = DateTime.Parse("11/06/2003"); string dts = dt.AddYears(3).ToString();
  • 0 Votes
    2 Posts
    0 Views
    M
    Check out the article at http://www.codeproject.com/useritems/chksavegrid.asp There is a sub called Iterate() that loops through each row and checks if the checkbox is checked. You can simply put a counter there and voila!