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
  • Visual Basic / Access Xp help

    help database question
    2
    0 Votes
    2 Posts
    0 Views
    M
    **Option Explicit Declare Function** GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) **As Long Type** MSA_OPENFILENAME ' Filter string used for the File Open dialog filters. ' Use MSA_CreateFilterString() to create this. ' Default = All Files, *.* strFilter As String ' Initial Filter to display. ' Default = 1. lngFilterIndex **As Long** ' Initial directory for the dialog to open in. ' Default = Current working directory. strInitialDir **As String** ' Initial file name to populate the dialog with. ' Default = ". strInitialFile **As String** strDialogTitle **As String** ' Default extension to append to file if user didn't specify one. ' Default = System Values (Open File, Save File). strDefaultExtension **As String** ' Flags (see constant list) to be used. ' Default = no flags. lngFlags **As Long** ' Full path of file picked. On OpenFile, if the user picks a ' nonexistent file, only the text in the 'File Name' box is returned. strFullPathReturned **As String** ' File name of file picked. strFileNameReturned<
  • Nested Classes (after much hair pulling)

    xml question workspace
    2
    0 Votes
    2 Posts
    0 Views
    Richard DeemingR
    Make the nested classes and their properties Public, but make the constructors as Friend. That way, only code within your assembly can create instances of the internal class. You may be better off using Shared methods instead, which would remove the need to create instances of the class. For example: Class App Public Class Paths Private Shared _Path1 as String Shared Sub New() 'Initialize your properties here End Sub Private Sub New() 'No need to create instances of this class End Sub Public Shared Readonly Property Path1 As String Get Return \_Path1 End Get End Property End Class Public Class Config Private Shared \_Setting1 As String Shared Sub New() 'Initialize your properties here End Sub Private Sub New() 'No need to create instances of this class End Sub Public Shared Readonly Property Setting1 As String Get Return \_Setting1 End Get End Property End Class Shared Sub New() 'Initialize any properties for App here End Sub Private Sub New() 'No need to create instances of this class End Sub End Class Then, you can just use: Dim Path1 As String = App.Paths.Path1 Updated: the member variables have to be Shared as well! :-O
  • Control array annoyances...

    csharp data-structures question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • help needed...!!!

    database sysadmin help question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Storing input to a cell in excel

    help debugging regex
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • multi text file processing

    help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Error when trying Update on SQLDataAdapter

    help question announcement
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Help!! VB.NET Custom DataGridColumn Problem ...

    help tutorial csharp graphics
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Acess Form Controls

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Web Services Implementation Guide

    wcf xml tutorial com design
    2
    0 Votes
    2 Posts
    0 Views
    J
    Stanford Suck... Berkeley Kick A~~
  • path help needed !!

    sysadmin help question
    2
    0 Votes
    2 Posts
    0 Views
    C
    add a comman Dialog active x control to your form. 1) add the component project-> components -> then place a check box next do comman dialog controls. 2) place the control on your form. 3)and then use code like below ComDialogfrmMain.CancelError = True ComDialogfrmMain.Flags = cdlOFNNoValidate ' Set filters ComDialogfrmMain.Filter = "All Files (*.*)|*.*|Text Files" & _ "(*.txt)|*.txt|Data Files (*.Dat)|*.Dat" ' Specify default filter ComDialogfrmMain.FilterIndex = 3 ' show dialog ComDialogfrmMain.ShowOpen xtFileName = ComDialogfrmMain.FileName
  • Why Doesnt This Work Again?

    question
    5
    0 Votes
    5 Posts
    0 Views
    J
    Do Events is evil... In general I have found that it cause more race conditions than anything. Try: ImageObject.Refresh()
  • MDI QueryUnloads

    html database com debugging help
    6
    0 Votes
    6 Posts
    0 Views
    J
    Sorry, I didn't post sooner .... I could not find my message :) I was not aware there was a vb section. I tried the different code: ...If CheckSave() Then Cancel = 1 But no, that has the exact same effect as the original code :(( it seems like the community thinks this should be an okay use of a form and a dialog, so I must be creating a referance or something that is messing me up... I am still looking into it Thanks for your time, All.
  • path help needed !!

    sysadmin help question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • VB Textbox Accept Code

    css design question
    3
    0 Votes
    3 Posts
    0 Views
    Richard DeemingR
    Look at the Validating event. It fires whenever you move the focus between controls which have CausesValidation = True. For example, if you have a TextBox, an "OK" button and a "Cancel" button, you would set CausesValidation = True for the TextBox and "OK" button, and False for the "Cancel" button. Then, when you tab away from the TextBox to the "OK" button, or click the "OK" button, your validation code runs. When you click the "Cancel" button, it doesn't run.
  • MSComm with DTREnable

    help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Debug a VC++ DLL from VBA

    debugging question c++
    2
    0 Votes
    2 Posts
    0 Views
    V
    1. Load the VC project of DLL, 2. set the breakpoints, 3. set the "Executable for debug session" (and m.b. Program argument etc.) in project's Settings, 4. "Go" for debug the DLL. 5. ignore the VC question about "Debug info was not found for ..." 6. after loading the <Executable>, e.g. VB6.EXE or Excel.EXE, set the its breakpoints if need and run the project. With best wishes, Vita
  • Try Catch Finally and variable declaration

    help question workspace
    2
    0 Votes
    2 Posts
    0 Views
    Z
    con needs to have been declared outside of the try block, as thus: Dim con As SqlConnection Dim cmd As SqlCommand Try con = New SqlConnection(Configuration.Settings("ConnectionString")) cmd = New SqlCommand("INSERT INTO Messages (MessageType, Message) VALUES('" & _ MessageType & "','" & Message & "')", con) cmd.ExecuteNonQuery() Catch e As Exception LogEvent(e.ToString(), EventLogEntryType.Error) Finally con.Close() End Try -John
  • Getting events from a web page.

    tutorial csharp linux question
    2
    0 Votes
    2 Posts
    0 Views
    C
    Use a LinkButton instead of a Hyperlink. LinkButtons raise a click event in ASPX.
  • add object to listbox

    com design help
    3
    0 Votes
    3 Posts
    0 Views
    M
    thanks for the reply....i actually was going about it wrong what i'm doing now (to my disguntlement) is keeping an arraylist of my objects in the session collection, and databinding to it...it's working fine i assumed that the ListBox.Items collection would hold objects (as long as they had a tostring() method), but i was wrong. you can, however databind to any object collection/list, as long as the tostring() method is provided, or a datavaluemember and datatextmember are specified michael griffith -------------------- mgriffith@lauren.com mdg12@po.cwru.edu