Results 1 to 4 of 4

Thread: VB Project - small desktop application. I am a beginner and need guidance throughout.

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2012
    Location
    Newcastle
    Posts
    12

    VB Project - small desktop application. I am a beginner and need guidance throughout.

    VB Project

    Hi everyone,

    I am a beginner in programming but have learned the basics over the past few weeks. I want to make a small desktop application for personal use in which I will be using a text-file database. I have been told this is as basic as it gets.

    Overview

    So the basic idea of this project is to create a digital version of my record collection (music vinyl). I aim to have a form in which I can essentially 'Add New Record' which has the following details:

    - Title
    - Artist
    - Type
    - Year
    - Image

    Once the details have been uploaded and the image retrieved from My Documents, I will click 'Add New' and this will save the details in the database. I also want this 'Add New' button to store the image in a variety of different forms depending on what 'Type' was selected. For example:

    There are 4 types:

    - 12" LP/EP
    - 10" LP/EP
    - 7" Single
    - 12" Single

    Each of the above will have its own section in the application where each record will be stored. In this section will be the image used when filling in the details in the 'Add New Record' page.

    Then, I will be able to click on the picture of a record and will lead me to the final screen which shows me all the details of that particular record and the enlarged image.

    The whole idea is to get all my record collection on, I have a lot of records and forget what I have. By having this application I will be able to see the front covers of each record and view the details of that record.

    It would be a huge help if someone gave me guidance with this project. I don't think it is too challenging for someone who has experience with VB.

    I already have the layout created on VB, just need help with the coding.

    Thanks in advance for anyone who shows an interest.

    Cheers!

    Conor.

  2. #2
    Junior Member
    Join Date
    Feb 2011
    Posts
    21

    Re: VB Project - small desktop application. I am a beginner and need guidance through

    I am new to VB also, from what I understand first you have to decide which database to use, for your needs i think SQlite would serve you best since its truly portable, once you have that, build a windows form with some buttons, like insert, delete, update, once you have successfully done that you should be already on the way to creating this application, you will find plenty of examples on the net for database connectivity and database operations.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2012
    Location
    Newcastle
    Posts
    12

    Re: VB Project - small desktop application. I am a beginner and need guidance through

    Hi mate, thanks for your reply!

    Well i've seeked some help from a friend who knows a touch about it, and he believes a simple text file as a Database would work for now. I already have the layout and all the forms created in VB. All I need is the code behind it. The main code is in the 'Add New Record' form. I will take a look at that SQlite which you recommend, thanks for your interest and help!

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2012
    Location
    Newcastle
    Posts
    12

    Re: VB Project - small desktop application. I am a beginner and need guidance through

    For the 'Add New Record' page, i've copied a piece of code from online and tried to adapt it for my needs, here is what i've done:

    'BeginAddNewVB

    Public Sub Main()
    On Error GoTo ErrorHandler

    Dim FILE_NAME As String = "H:\Placement\University\mrc.txt"

    If System.IO.File.Exists(H:\Placement\University\mrc.txt) = True Then

    Dim objWriter As New System.IO.StreamWriter(H:\Placement\University\mrc.txt)

    objWriter.Write(titletextbox.Text)
    objWriter.Write(artisttextbox.Text)
    objWriter.Write(type.dropdownlist.SelectedItem.Value)
    objWriter.Write(yeartextbox.Text)
    objWriter.Write(catnotextbox.Text)
    objWriter.Close()
    MsgBox("Text written to file")

    Else

    MsgBox("Please enter all information")

    End If

    Dim strTitle As String
    Dim strArtist As String
    Dim strYear As String
    Dim strType As String
    Dim strCatNo As String
    Dim blnRecordAdded As Boolean

    strTitle = Trim(InputBox("Enter Title:"))
    strArtist = Trim(InputBox("Enter Artist:"))
    strYear = Trim(InputBox("Enter Year:"))
    strType = Trim(InputBox("Enter Type:"))
    strCatNo = Trim(InputBox("Enter Category Number:"))

    If strTitle <> "" And strArtist <> "" And <> "" strYear And strType <> "" And strCatNo <> "" Then

    rstRecords.AddNew
    rstRecords!title = strTitle
    rstRecords!artist = strArtist
    rstRecords!artist = strYear
    rstRecords!artist = strType
    rstRecords!artist = strCatNo
    rstRecords.Update
    blnRecordAdded = True

    MsgBox "New record: " & rstRecords!RecordId & " " & _
    rstRecords!Title & " " & rstEmployees!Artist & " " & rstRecords!Year & " " & rstRecords!Type & " " & rstRecords!CatNo

    Else
    MsgBox "Please enter all information."
    End If

    rstRecords.Close
    Cnxn.Close
    Set rstRecords = Nothing
    Set Cnxn = Nothing
    Exit Sub

    ErrorHandler:
    ' clean up
    If Not rstRecords Is Nothing Then
    If rstRecords.State = adStateOpen Then rstRecords.Close
    End If
    Set rstRecords = Nothing

    If Not Cnxn Is Nothing Then
    If Cnxn.State = adStateOpen Then Cnxn.Close
    End If
    Set Cnxn = Nothing

    If Err <> 0 Then
    MsgBox Err.Source & "-->" & Err.Description, , "Error"
    End If
    End Sub
    'EndAddNewVB

    The above code was used for adding a new record of an employee. This is similar as my vinyl records can be treated as a person. Where the choice of Male and Female usually is, mine will be the choice between:

    - 12" LP/EP
    - 10" LP/EP
    - 7" Single
    - 12" Single

    Is this code heading in the right direction? Thanks in advance!
    Last edited by bluecdunn; Aug 31st, 2012 at 03:11 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width