Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4325082
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:13:10+00:00 2026-05-21T09:13:10+00:00

Ive only recently starting fiddling with Visual Basic Express and Sql Databases. Ive managed

  • 0

Ive only recently starting fiddling with Visual Basic Express and Sql Databases.

Ive managed to get a database up and running, and can query information from it. I have even created a form that can add a new entry to the table im using.

The first form has a ComboBox that list the PlayerNames in my table. Form2 allows you to add a new name to the table, but anything I add isnt immediately updated in Form1. I have to relaunch the program to see the new entries. Even then, these new entries dont seem to be permanent as they eventually dissappear.

The code I have for Form1:

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Dim db = New PlayerTestDataContextDataContext()
    Dim PlayerList = From List In db.Players
                     Select List.PlayerName

    For Each PName In PlayerList

        cbPList.Items.Add(PName)

    Next

End Sub


Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreate.Click

    frmNewPlayer.Show()

End Sub

End Class

The code for Form2:

   Private Sub btnCPlayer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCPlayer.Click

    Dim db = New PlayerTestDataContextDataContext()

    If txtNewPlayer.Text = "" Then
        lbWarning.Text = "Please enter a name!"
    Else
        Dim Plyr As New Player With {
            .PlayerName = txtNewPlayer.Text}
        db.Players.InsertOnSubmit(Plyr)
        db.SubmitChanges()
        Me.Close()

    End If

End Sub

Not sure what is going wrong here…any help is appreciated. If I have overlooked an obvious answer around here forgive me, Im not sure what I need to be looking for.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T09:13:10+00:00Added an answer on May 21, 2026 at 9:13 am

    That should do the trick. But you need to do some reading …

    Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreate.Click    
        if frmNewPlayer.ShowDailog() == DialogResult.Ok
            Dim db = New PlayerTestDataContextDataContext()
            Dim PlayerList = 
            From List In db.Players                     
            Select List.PlayerName  
            ' 
            cbpList.Items.Clear()
            '
            For Each PName In PlayerList
                cbPList.Items.Add(PName)    
            Next
        end if
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've only recently started using the Visual Studio Command Window, and for the vast
I have been working on optimizing my Postgres databases recently, and traditionally, I've only
SQL server Manager 2008. Ive recently changed a stored procedure to look at a
I've only recently noticed the Filter element in the definition file for a SharePoint
I'm a complete newbie when it comes to OCaml. I've only recently started using
I've recently come across a C program in which the main function only took
Recently I've wanted to do a number of things using CSS only to find
I feel like I've only ever seen this here on SO, but I can't
I've only recently noticed a crash in one of my apps when an object
I've only recently been getting involved with PHP/AJAX/jQuery and it seems to me that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.