VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 307,035 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,279 people online right now. Registration is fast and FREE... Join Now!




Phone Book program

 

Phone Book program, help needed....

mobrecords07

26 Apr, 2007 - 12:13 PM
Post #1

New D.I.C Head
*

Joined: 13 Feb, 2007
Posts: 13


My Contributions
Alright I already set up the phonebook form. I just need to input the codes for buttons ADD, DELETE, & FIND. Can someone please help, much appreciated.


IPB Image

CODE
Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim aname() As String
    Dim room() As String
    Dim Phone() As String
    Dim index As Integer

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

#End Region

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

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        aname(index) = txtname.Text
        room(index) = txtroom.Text
        Phone(index) = txtphone.Text


    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim x As Integer
        For x = 1 To 1
            Dim aname() As String
            ListBox1.Items.Add("Mike")
            ListBox1.Items.Add("Amber")
            ListBox1.Items.Add("George")
            ListBox1.Items.Add("Nicole")
            ListBox1.Items.Add("Chris")
        Next

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Dim x As Integer
        Dim num As Integer
        Dim find As Integer
        Dim flag As Integer
        flag = 0
        find = Val(TextBox4.Text)
        For x = 0 To (index - 1)
            If (find = aname(x)) Then
                flag = 1
                num = x
            End If
        Next
        If (flag = 1) Then
            ListBox1.Items.Add("Item Found")
            ListBox1.Items.Add(aname(num))
            ListBox1.Items.Add(room(num))
            ListBox1.Items.Add(Phone(num))






        End If
    End Sub
End Class


User is offlineProfile CardPM
+Quote Post


Jayman

RE: Phone Book Program

26 Apr, 2007 - 10:43 PM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 8,570



Thanked: 237 times
Dream Kudos: 500
Expert In: Everything

My Contributions
What exactly are you having a problem with?
User is offlineProfile CardPM
+Quote Post

mobrecords07

RE: Phone Book Program

29 Apr, 2007 - 09:19 PM
Post #3

New D.I.C Head
*

Joined: 13 Feb, 2007
Posts: 13


My Contributions
I need help with the code, so that when I input names in the textboxes it appears in the Listbox
User is offlineProfile CardPM
+Quote Post

Jayman

RE: Phone Book Program

29 Apr, 2007 - 10:21 PM
Post #4

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 8,570



Thanked: 237 times
Dream Kudos: 500
Expert In: Everything

My Contributions
To input the names directly from a textbox into your listbox. You simple need to retrieve the value from the Text property of the textbox and use the Add method to add it to a listbox.

Like this:
CODE

ListBox1.Items.Add(txtName.Text)


User is offlineProfile CardPM
+Quote Post

BlackRose1986

RE: Phone Book Program

11 Aug, 2009 - 03:26 AM
Post #5

New D.I.C Head
*

Joined: 11 Aug, 2009
Posts: 1

So how do can Save your Records?

This post has been edited by AdamSpeight2008: 11 Aug, 2009 - 04:09 AM
User is offlineProfile CardPM
+Quote Post

firebolt

RE: Phone Book Program

11 Aug, 2009 - 03:54 AM
Post #6

D.I.C Lover
Group Icon

Joined: 20 Feb, 2009
Posts: 5,476



Thanked: 77 times
Dream Kudos: 1675
My Contributions
Wrong forum. Should be in the VB.NET forum.


User is offlineProfile CardPM
+Quote Post

mark.bottomley

RE: Phone Book Program

11 Aug, 2009 - 05:28 AM
Post #7

D.I.C Addict
****

Joined: 22 Apr, 2009
Posts: 868



Thanked: 148 times
My Contributions
If you want us to read you code - USE REAL NAMES for your controls, not the default ones such as Button1 e.g. btnAddNewName - then we stand a chance of figuring out what your code is trying to do.

You should also read the ListBox documentation (and ListView) as ListView in particular supports sorting and column headers and you can click on the column header to sort on that column.

You will also need to access things like the SelectedIndex to determine a ListView entry for Deletion.
User is offlineProfile CardPM
+Quote Post

masokis

RE: Phone Book Program

14 Aug, 2009 - 06:55 PM
Post #8

New D.I.C Head
*

Joined: 14 Aug, 2009
Posts: 4


My Contributions
This thread shoul be move to VB.net forum..
i getting noob here.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 08:38AM

Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month