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

Join 149,487 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,322 people online right now. Registration is fast and FREE... Join Now!




Phone Book program

 
Reply to this topicStart new topic

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: 7,302



Thanked: 66 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: 7,302



Thanked: 66 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

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 04:59PM

Be Social

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

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month