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
  • Setting System Time

    question
    6
    0 Votes
    6 Posts
    0 Views
    N
    Doh! Thanks :-D_ ------------------------------------------ I beat the internet - the end guy is hard. _
  • Translate VB Function -> C++

    question c++
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • ACCESS / VB / OPENFILEDIALOG

    database com help
    4
    0 Votes
    4 Posts
    0 Views
    H
    Hi,, this is strange I just install Visual studio 6 and use the control and nothing more!!
  • "Operation not allowed when object is open"

    help question
    3
    0 Votes
    3 Posts
    0 Views
    R
    The error you mention generally occurrs when attempting to open an ADODB.Recordset object when it's already open - if you're reporting from a DB, this will prob be the cause, but suspect that it won't be in your code? Does that help? "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox
  • Use of apostrophe in string

    database collaboration help
    4
    0 Votes
    4 Posts
    0 Views
    R
    If you're trying to insert into a database, just double-up the quotes, so : INSERT INTO table VALUES 'O'Connor' becomes INSERT INTO table VALUES 'O'**'**Connor' have some functions to do this, or just use a replace. This approach has the advantage that the string is stored with the apostrophe in place "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox
  • How to run an .exe app from within a function

    tutorial
    3
    0 Votes
    3 Posts
    0 Views
    R
    An even simpler (and apparently more thread-safe for some reason that someone once told me that I can't remember!) is to use ShellExecute function - use the API viewer to get the VB prototype "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox
  • Searching for files DateModified value

    algorithms question
    4
    0 Votes
    4 Posts
    0 Views
    Richard DeemingR
    Both the FileInfo and DirectoryInfo classes inherit from FileSystemInfo, which has the properties you need. For example, LastWriteTime is the modified date/time. Just off the top of my head: Imports System.IO Imports System.Collections ... Public Shared Function Search(ByVal folder As String, ByVal minDate As Date) As FileInfo() Dim files As New ArrayList() Dim folderEntry As New DirectoryInfo(folder) SearchInternal(folderEntry, files, minDate) Return DirectCast(files.ToArray(GetType(FileInfo)), FileInfo()) End Function Private Shared Sub SearchInternal(ByVal folder As DirectoryInfo, ByVal files As ArrayList, ByVal minDate As Date) If folder.Exists Then ' List the files in the current directory Dim file As FileInfo For Each file In folder.GetFiles() If file.LastWriteTime > minDate Then files.Add(file) End If Next ' Search the subdirectories Dim subfolder As DirectoryInfo For Each subfolder In folder.GetDirectories() SearchInternal(subfolder, files, minDate) Next End If End Sub "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • 0 Votes
    3 Posts
    0 Views
    A
    use the function TypeName
  • difference between windows Shutdown and restart

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Update Dataset from a Datagrid

    wpf wcf help question announcement
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • How to customize a windows media player in VB 6?

    tutorial business help question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • String Object Referrence

    csharp help question discussion
    5
    0 Votes
    5 Posts
    0 Views
    N
    Yep, that's exactly what I wanted to do, though i figured out the string immutability thing after countless reference books later. :-O But thanks for the reply. This limitation of .net makes me long for those good old C++ days :) Notorious SMC The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning Mark Twain Get your facts first, and then you can distort them as much as you please Mark Twain
  • Command line arguments

    c++ help tutorial question
    3
    0 Votes
    3 Posts
    0 Views
    N
    Thank you! Just what I was hoping for. :) QRZ? de WAƘTTN
  • VBCRLF

    csharp question
    3
    0 Votes
    3 Posts
    0 Views
    N
    VBCRLF works in .net too Notorious SMC The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning Mark Twain Get your facts first, and then you can distort them as much as you please Mark Twain
  • VB Macro to add files to project

    question xml
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Forms sticking VB6

    database help
    3
    0 Votes
    3 Posts
    0 Views
    R
    Thanks!! That has definitely helped!!
  • 0 Votes
    5 Posts
    0 Views
    D
    At some point you have to debug this exception. You can't just keep ingoring it. Deep down though I realise it's an essential part of the program flow however.
  • Windows Service for Printing HTML

    csharp html data-structures help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Multiple Instances of a class

    help question
    3
    0 Votes
    3 Posts
    0 Views
    N
    Here hope this helps clarify things a bit more. (Psudo code to follow) Public Class frmMain 'This the standard windows form code Private m_FileMon as clsMyFileMon Private sub_cmdStart_Click m_FileMon = new clsMyFileMon End Sub End Class Public Class clsMyFileMon Imports System.IO Imports System.Timers Imports System.Diagnostics Public Sub New 'Starting new timers and a new instance of 'the filesystem watcher. Using AddHandler 'to add event handlers for the timer_tick event and 'the filesystemwatcher created event. End sub End Class 'I am watching for the creation of files in a specific folder 'then after a given amount of time I delete those files End Class So here is the problem. Every time I click cmdStart it is starting another instance of my class. I know this because for every click of cmdStart I am getting another set of timers. The old instance is not being cleaned up. I have tried to kill the old instance by m_FileMon = Nothing, but the Finalize event does not fire. Is this because the timers and the filesystemwatch are executing on different threads? Do I need to implement IDispose to unhook the timers from my object and force the garbage collector to kill my class? Any help would be greatly appriciated. Forever Developing
  • 0 Votes
    7 Posts
    0 Views
    S
    Public Function addplayer(ByVal player As String, ByVal score As Integer) As String() Dim please() As String Dim studx As CPlayer studx = New CPlayer(player, score) 'passes player name and score to studx? ReDim Preserve array(number) '<<< must be 'sets the size of the array array(number) = studx 'passes playername and score to array? please = buildarray() Return please End Function #End Region #Region "should build array" Private Function buildarray() As String() Dim j As Integer Dim a(number - 1) As String For j = 0 To number - 1 a(j) = array(j).ToString '<--- 'it blows up each time it gets to here Next Return a End Function this is in my Cplayer class Public Overrides Function toString() As String Dim strtemp As String strtemp = Me.player & " : " & CStr(Me.score) Return strtemp End Function can anybody help with this?