Click here to Skip to main content
15,902,634 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: help Pin
Christian Graus16-Sep-07 9:02
protectorChristian Graus16-Sep-07 9:02 
AnswerRe: help Pin
Naji El Kotob16-Sep-07 10:44
Naji El Kotob16-Sep-07 10:44 
GeneralRe: help Pin
twsted f817-Sep-07 23:52
twsted f817-Sep-07 23:52 
AnswerRe: help Pin
rohitsrivastava16-Sep-07 23:38
rohitsrivastava16-Sep-07 23:38 
Questionvalidating text boxes Pin
twsted f816-Sep-07 8:23
twsted f816-Sep-07 8:23 
AnswerRe: validating text boxes Pin
Paul Conrad16-Sep-07 8:30
professionalPaul Conrad16-Sep-07 8:30 
AnswerRe: validating text boxes Pin
Santosh metal16-Sep-07 17:21
Santosh metal16-Sep-07 17:21 
Questionneed halp for bad record length error [modified] Pin
bapu288916-Sep-07 8:08
bapu288916-Sep-07 8:08 
hello i am new in vb.net
and i am doing phone direcroty application, so in this application input is users name, middle name, surname,home phone,mobile,email,houseno, add,town,postcode,counrty etc and i have used all this as string variable

and code is like this

Option Explicit On <br />
Option Strict On<br />
Public Class frmPhone<br />
    Inherits System.Windows.Forms.Form<br />
<br />
    'Globle variables<br />
    Dim FileNumber, Position As Integer, FileName As String<br />
    Dim MyFile As String = "phonelist.txt"<br />
<br />
    'create record type the name of record is PhoneList<br />
    Structure PhoneList<br />
        Dim Inits As String<br />
        Dim Gender As String<br />
        <VBFixedString(20)> Dim FName As String<br />
        <VBFixedString(20)> Dim SName As String<br />
        <VBFixedArray(2)> Dim MName As String<br />
        <VBFixedArray(20)> Dim HomePhone As String<br />
        <VBFixedArray(20)> Dim Mobile As String<br />
        <VBFixedArray(30)> Dim Email As String<br />
        <VBFixedArray(5)> Dim HouseNo As String<br />
        <VBFixedArray(20)> Dim FLine As String<br />
        <VBFixedArray(20)> Dim SLine As String<br />
        <VBFixedArray(20)> Dim Town As String<br />
        <VBFixedArray(10)> Dim PostCode As String<br />
        <VBFixedArray(15)> Dim Country As String<br />
    End Structure<br />
    'Function to use last record<br />
    Private Function FindLastRecordNo() As Integer<br />
        Dim Temp As PhoneList, FileNum As Integer<br />
        FileNum = FreeFile() 'Free file number<br />
        FileOpen(FileNum, MyFile, OpenMode.Random, , , Len(Temp))<br />
        FindLastRecordNo = 1<br />
        Do While Not EOF(FileNum) 'EOF() function is using to detect the end of file<br />
            Dim vt As ValueType = Temp<br />
            FileGet(FileNum, vt, ) 'Get file file function is using to get record from random file<br />
            Temp = CType(vt, PhoneList)<br />
            FindLastRecordNo = FindLastRecordNo + 1<br />
        Loop<br />
        FileClose(FileNum)<br />
    End Function<br />
<br />
<br />
    Private Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click<br />
        Dim Response As DialogResult<br />
        Dim PhoneBook As PhoneList, LastRecord, I As Integer<br />
        txtName.Text = StrConv(txtName.Text, VbStrConv.ProperCase)<br />
        txtMiddle.Text = StrConv(txtMiddle.Text, VbStrConv.ProperCase)<br />
        txtSurname.Text = StrConv(txtSurname.Text, VbStrConv.ProperCase)<br />
        txtFirstLine.Text = StrConv(txtFirstLine.Text, VbStrConv.ProperCase)<br />
        txtSecondLine.Text = StrConv(txtSecondLine.Text, VbStrConv.ProperCase)<br />
        txtTown.Text = StrConv(txtTown.Text, VbStrConv.ProperCase)<br />
        txtPostCode.Text = StrConv(txtPostCode.Text, VbStrConv.UpperCase)<br />
        LastRecord = FindLastRecordNo() 'call last record function <br />
        'Check if all three text boxes in tabpage add is not blank<br />
        FileNumber = FreeFile()<br />
        FileOpen(FileNumber, MyFile, OpenMode.Random, , , Len(PhoneBook))<br />
        PhoneBook.Inits = cboInits.Text<br />
        PhoneBook.Gender = cboGender.Text<br />
        PhoneBook.FName = txtName.Text<br />
        PhoneBook.MName = txtMiddle.Text<br />
        PhoneBook.SName = txtSurname.Text<br />
        PhoneBook.HomePhone = CStr(Val(txtHome.Text))<br />
        PhoneBook.Mobile = CStr(Val(txtMobile.Text))<br />
        PhoneBook.Email = CStr(Val(txtEmail.Text))<br />
        PhoneBook.HouseNo = CStr(Val(txtHouse.Text))<br />
        PhoneBook.FLine = txtFirstLine.Text<br />
        PhoneBook.SLine = txtSecondLine.Text<br />
        PhoneBook.Town = txtTown.Text<br />
        PhoneBook.PostCode = txtPostCode.Text<br />
        PhoneBook.Country = cboCountry.Text<br />
        FilePut(FileNumber, PhoneBook, LastRecord)<br />
        FileClose(FileNumber)<br />
        MessageBox.Show("Item successfuly Saved", "Item Saved", MessageBoxButtons.OK, MessageBoxIcon.Information)<br />
    End Sub<br />
End Class


but it's shows error that bad record length i have debug program several times but i can not understand what to do, in local windows it's shows few information like name, middle name,surname,home phone,mobile but rest is nothing but how can i solve this problem

can any body help me with this

waiting for your kind rep.

Cry | :((
Confused | :confused:




-- modified at 14:49 Sunday 16th September, 2007
AnswerRe: need halp for bad record length error Pin
Paul Conrad16-Sep-07 8:17
professionalPaul Conrad16-Sep-07 8:17 
GeneralRe: need halp for bad record length error Pin
bapu288916-Sep-07 8:33
bapu288916-Sep-07 8:33 
AnswerRe: need halp for bad record length error Pin
Christian Graus16-Sep-07 9:01
protectorChristian Graus16-Sep-07 9:01 
GeneralRe: need halp for bad record length error Pin
Paul Conrad16-Sep-07 17:41
professionalPaul Conrad16-Sep-07 17:41 
AnswerRe: need halp for bad record length error Pin
bapu288917-Sep-07 7:57
bapu288917-Sep-07 7:57 
QuestionBeigners Pin
Mahendhirans16-Sep-07 5:58
Mahendhirans16-Sep-07 5:58 
AnswerRe: Beigners Pin
Christian Graus16-Sep-07 6:11
protectorChristian Graus16-Sep-07 6:11 
AnswerRe: Beigners Pin
Paul Conrad16-Sep-07 6:47
professionalPaul Conrad16-Sep-07 6:47 
AnswerRe: Beigners Pin
Naji El Kotob16-Sep-07 10:49
Naji El Kotob16-Sep-07 10:49 
QuestionNewBee needs help converting text file to wav file in vb6. Pin
Robert from Florida16-Sep-07 5:20
Robert from Florida16-Sep-07 5:20 
AnswerRe: NewBee needs help converting text file to wav file in vb6. Pin
Christian Graus16-Sep-07 5:38
protectorChristian Graus16-Sep-07 5:38 
GeneralRe: NewBee needs help converting text file to wav file in vb6. Pin
Robert from Florida16-Sep-07 5:59
Robert from Florida16-Sep-07 5:59 
GeneralRe: NewBee needs help converting text file to wav file in vb6. Pin
Christian Graus16-Sep-07 6:09
protectorChristian Graus16-Sep-07 6:09 
GeneralRe: NewBee needs help converting text file to wav file in vb6. Pin
Robert from Florida16-Sep-07 6:26
Robert from Florida16-Sep-07 6:26 
GeneralRe: NewBee needs help converting text file to wav file in vb6. Pin
Christian Graus16-Sep-07 6:30
protectorChristian Graus16-Sep-07 6:30 
GeneralRe: NewBee needs help converting text file to wav file in vb6. Pin
Robert from Florida16-Sep-07 6:38
Robert from Florida16-Sep-07 6:38 
GeneralRe: NewBee needs help converting text file to wav file in vb6. Pin
Christian Graus16-Sep-07 7:37
protectorChristian Graus16-Sep-07 7:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.