Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 26th, 2007, 06:18 AM
Registered User
 
Join Date: Sep 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Writing to the String Collection Editor

Is there a way to write to a String Collection Editor at runtime through code in VB.NET 2003?

The following is the code I am using and it doesn't work.
Imports Microsoft.Office.Interop
Imports System.Collections

Public Class frmMainMenu
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
    Friend WithEvents lblSubTitle As System.Windows.Forms.Label
    Friend WithEvents lblTitle As System.Windows.Forms.Label
    Friend WithEvents cboDatabases As System.Windows.Forms.ComboBox
    Friend WithEvents lstCustomMenu As System.Windows.Forms.ListBox
    Friend WithEvents btnExit As System.Windows.Forms.Button
    Friend WithEvents lblInstructions As System.Windows.Forms.Label
    Friend WithEvents btnSave As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmMainMe nu))
        Me.PictureBox1 = New System.Windows.Forms.PictureBox
        Me.lblSubTitle = New System.Windows.Forms.Label
        Me.lblTitle = New System.Windows.Forms.Label
        Me.cboDatabases = New System.Windows.Forms.ComboBox
        Me.lstCustomMenu = New System.Windows.Forms.ListBox
        Me.btnExit = New System.Windows.Forms.Button
        Me.lblInstructions = New System.Windows.Forms.Label
        Me.btnSave = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'PictureBox1
        '
        Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
        Me.PictureBox1.Location = New System.Drawing.Point(344, 64)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(288, 296)
        Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchIma ge
        Me.PictureBox1.TabIndex = 6
        Me.PictureBox1.TabStop = False
        '
        'lblSubTitle
        '
        Me.lblSubTitle.Location = New System.Drawing.Point(344, 360)
        Me.lblSubTitle.Name = "lblSubTitle"
        Me.lblSubTitle.Size = New System.Drawing.Size(288, 24)
        Me.lblSubTitle.TabIndex = 7
        Me.lblSubTitle.Text = "Just A Click Away!"
        Me.lblSubTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'lblTitle
        '
        Me.lblTitle.Font = New System.Drawing.Font("Microsoft Sans Serif", 24.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblTitle.Location = New System.Drawing.Point(0, 8)
        Me.lblTitle.Name = "lblTitle"
        Me.lblTitle.Size = New System.Drawing.Size(976, 32)
        Me.lblTitle.TabIndex = 8
        Me.lblTitle.Text = "Florida Databases"
        Me.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'cboDatabases
        '
        Me.cboDatabases.Location = New System.Drawing.Point(8, 120)
        Me.cboDatabases.Name = "cboDatabases"
        Me.cboDatabases.Size = New System.Drawing.Size(240, 21)
        Me.cboDatabases.Sorted = True
        Me.cboDatabases.TabIndex = 9
        '
        'lstCustomMenu
        '
        Me.lstCustomMenu.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(255, Byte), CType(255, Byte))
        Me.lstCustomMenu.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.lstCustomMenu.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lstCustomMenu.Location = New System.Drawing.Point(8, 168)
        Me.lstCustomMenu.Name = "lstCustomMenu"
        Me.lstCustomMenu.Size = New System.Drawing.Size(240, 130)
        Me.lstCustomMenu.Sorted = True
        Me.lstCustomMenu.TabIndex = 10
        '
        'btnExit
        '
        Me.btnExit.Location = New System.Drawing.Point(640, 424)
        Me.btnExit.Name = "btnExit"
        Me.btnExit.TabIndex = 11
        Me.btnExit.Text = "E&xit"
        '
        'lblInstructions
        '
        Me.lblInstructions.Location = New System.Drawing.Point(16, 80)
        Me.lblInstructions.Name = "lblInstructions"
        Me.lblInstructions.Size = New System.Drawing.Size(232, 24)
        Me.lblInstructions.TabIndex = 12
        Me.lblInstructions.Text = "Please select the databases that you use."
        '
        'btnSave
        '
        Me.btnSave.Location = New System.Drawing.Point(80, 320)
        Me.btnSave.Name = "btnSave"
        Me.btnSave.TabIndex = 13
        Me.btnSave.Text = "&Save"
        '
        'frmMainMenu
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 13)
        Me.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(255, Byte), CType(255, Byte))
        Me.ClientSize = New System.Drawing.Size(992, 458)
        Me.Controls.Add(Me.btnSave)
        Me.Controls.Add(Me.lstCustomMenu)
        Me.Controls.Add(Me.lblInstructions)
        Me.Controls.Add(Me.btnExit)
        Me.Controls.Add(Me.cboDatabases)
        Me.Controls.Add(Me.lblTitle)
        Me.Controls.Add(Me.lblSubTitle)
        Me.Controls.Add(Me.PictureBox1)
        Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Name = "frmMainMenu"
        Me.Text = "Main Menu"
        Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
        Me.ResumeLayout(False)

    End Sub

#End Region
'Loads the cboDatabase when the form is loaded
    Private Sub frmMainMenu_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
        cboDatabases.Items.Add("Delinquency Database")
        cboDatabases.Items.Add("Florida Subcontractor Database")
        cboDatabases.Items.Add("MA Faxes Database")
        cboDatabases.Items.Add("PUC Pool Database")
        cboDatabases.Items.Add("Premium Accuracy Database")
        cboDatabases.Items.Add("Premium Maximization Database")
        Me.lblInstructions.Visible = True
        Me.cboDatabases.Visible = True
    End Sub
    'Adds the items to the list box when the user selects the database
    Private Sub cboDatabases_SelectedIndexChanged(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles cboDatabases.SelectedIndexChanged
        lstCustomMenu.SelectionMode = SelectionMode.One
        lstCustomMenu.BeginUpdate()
        Select Case cboDatabases.Text
            Case "Delinquency Database"
                lstCustomMenu.Items.Add("Delinquency Database")
            Case "Florida Subcontractor Database"
                lstCustomMenu.Items.Add("Florida Subcontractor Database")
            Case "MA Faxes Database"
                lstCustomMenu.Items.Add("MA Faxes Database")
            Case "PUC Pool Database"
                lstCustomMenu.Items.Add("PUC Pool Database")
            Case "Premium Accuracy Database"
                lstCustomMenu.Items.Add("Premium Accuracy Database")
            Case "Premium Maximization Database"
                lstCustomMenu.Items.Add("Premium Maximumization Database")
        End Select
        lstCustomMenu.EndUpdate()
    End Sub
    'Opens the database selected from the list box
    Private Sub lstCustomMenu_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstCustomMenu.SelectedIndexChanged
        Dim objAccess As Access.Application
        objAccess = New Access.ApplicationClass

        objAccess.Visible = True

        Select Case lstCustomMenu.Text
            Case "Delinquency Database"
                objAccess.OpenCurrentDatabase(filepath:="\\tsb124m 3\$natdata\Delinquency_Database\delinquency.mdb")
                objAccess = Nothing
            Case "Florida Subcontractor Database"
                objAccess.OpenCurrentDatabase(filepath:="\\tsb124m 3\\$natdata\PERFRPT\2000 SERVICE REPORT\AMU Shortcuts\FlSubContractor.mdb")
                objAccess = Nothing
            Case "MA Faxes Database"
                objAccess.OpenCurrentDatabase(filepath:="\\tsb124m 3\$natdata\MA COI Fax\MAFaxes.mdb")
                objAccess = Nothing
            Case "PUC Pool Database"
                objAccess.OpenCurrentDatabase(filepath:="\\tsb124m 3\$natdata\Perfrpt\2000 Service Report\pcu-pool.mdb")
                objAccess = Nothing
            Case "Premium Accuracy Database"
                objAccess.OpenCurrentDatabase(filepath:="\\tsb124m 3\$natdata\Premium_Accuracy_Databases\PA_Calculato r.mdb")
                objAccess = Nothing
            Case "Premium Maximization Database"
                objAccess.OpenCurrentDatabase(filepath:="\\tsb124m 3\$natdata\Premium_Accuracy_Databases\Premium Maximization.mdb")
                objAccess = Nothing
        End Select
    End Sub
    'Closes the application
    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Me.lblInstructions.Visible = False
        Me.cboDatabases.Visible = False
    End Sub
End Class



Thanks,
Dick LaFrance
[email protected]


Richard A. LaFrance





Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating XML doc ; writing string(xml format) into KamalRaturi XML 5 May 28th, 2008 05:51 AM
Can anybody help? Collection in C# naveenj .NET Framework 2.0 4 July 15th, 2007 09:34 PM
Collection in C# ? dedex C# 1 January 14th, 2005 04:51 PM
COM Collection ben0027 Visual C++ 0 May 1st, 2004 05:19 AM
Help collection gone MikeB VS.NET 2002/2003 2 June 12th, 2003 02:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.