e3aa463a715bf7d059e1bb1c76bea2ba
Hi,

Quoted Text Here

can anyone help me....i need help in this project... 1st thing is File type...the code i want is to only check the file type as binary, csv, etc...
2nd in Data Type....i have to count if the data type is 256 or 512... 3rd in Delimeter... if i use seperator i have to show which seperator i use..
` 4th is.. i have to show the fill char..eg. like 0 ...

Edited 2 Years Ago by nayzin.phyo: to add pic

Option Explicit
'==================================================================================================
Dim GetText As Long

Private Sub chkFileType_Click(Index As Integer)
    Frame2.Enabled = True
End Sub

'==================================================================================================
Private Sub cmdBrowse_Click()
On Error Resume Next
Dim sFile As String

    With cPath
        '.CancelError = True
        .InitDir = "C:\"
        .Filter = "All Files (*.*)|*.*|RTF (*.rtf)|*.rtf|Text Files (*.txt)|*.txt"
        .DialogTitle = "Select File....."
        .DefaultExt = "txt"
        .ShowOpen
        .CancelError = True
    If Len(.FileName) = 0 Then
        Exit Sub
    End If
    sFile = .FileName
    End With
    txtFilePath.Text = sFile
    txtFileName.Text = cPath.FileTitle
    ReadTextFile
    'ReadLinebyLine
    Frame1.Enabled = True
End Sub

'==================================================================================================
'Text10.Text = Len(CompleteText) - 1
    'If optDataType(0).Value Then
    '    Text10.Text = Len(CompleteText) - 1
    'End If
    'Text10.Text = Len(Text9.Text)

    'txtOutput.Text = vFront & vBack
'==================================================================================================
Sub ReadTextFile()
'Dim a
Dim fs1, f1
Set fs1 = CreateObject("Scripting.FileSystemObject")
Set f1 = fs1.OpenTextFile(txtFilePath.Text, 1)
f1.Close
End Sub

'==================================================================================================
Private Sub cmdSave_Click()
Dim ff
Dim strBuff As String
    With cPath
        .ShowSave
        .CancelError = True
    End With
    ff = FreeFile
Open txtFilePath.Text For Output Lock Read As #ff         'open text1.text
        Print #ff, txtOutput.Text                      '"print" text1.text into yay.txt
        Close #ff                                   'close text1.text
End Sub

'==================================================================================================
Private Sub Form_Load()
    Frame1.Enabled = False
    Frame2.Enabled = False
    'Frame3.Enabled = False
    'Frame4.Enabled = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set frmDriverSetup = Nothing
End Sub

'==================================================================================================
'Private Sub chkFileType_Click(Index As Integer)
'Dim strInfo As String
'    strInfo = " Item Selected:"
'    If chkFileType(0) = vbChecked Then strInfo = strInfo & " Binary"
'    If chkFileType(1) = vbChecked Then strInfo = strInfo & " CSV"
'    If chkFileType(2) = vbChecked Then strInfo = strInfo & " JIS"
'    If chkFileType(3) = vbChecked Then strInfo = strInfo & " Sequential File"
'
'    lblcheck = strInfo
'
'End Sub
'==================================================================================================
Private Sub optDataType_Click(Index As Integer)
    Select Case Index
    Case Is = 0
        'Text10.Text = Len(Text9.Text)
    End Select
    Frame3.Enabled = True
End Sub

'==================================================================================================
'txtData.Text = val(txtFillChr.Text + Val(txtWidth.Text)
    'For i = 1 To Notxt
    '    vFront = vFront & txtFillChr.Text
    '    vBack = vBack & txtFillChr.Text
    'Next i

'==================================================================================================
Private Sub chkFill_Click(Index As Integer)
Dim Notxt As Integer
Dim vFront, vBack, vFront1, vBack1 As String
Dim i As Integer
Dim a As String
Dim strBuff As String
Dim CompleteText As String
Dim ff
Dim NewStr
Dim Mid$

    a = txtFillChr.Text

    ff = FreeFile
    Open txtFilePath.Text For Input As #ff                      'open
    Do Until EOF(ff)                                            'do until end of the file
       Line Input #ff, strBuff                                  'input line by line into strbuff
       CompleteText = CompleteText & " " & strBuff
       Text9.Text = strBuff
    Loop
    Close #ff                                                   'close it
    Text10.Text = Len(Text9.Text)
    'vFront = Mid$(CompleteText, txtStart(0).Text, txtWidth(0).Text)
    Notxt = 256 - Val(CompleteText)
    Select Case Index
    Case Is = 1
    vFront = Left$(Text9.Text, txtStart(0).Text)
    vBack = Right$(Text9.Text, Val(Text10.Text) - txtStart(0).Text)
    For i = 1 To txtWidth(0).Text
        vFront = vFront & a
        NewStr = NewStr & txtFillChr.Text
    Next i
    txtData(0).Text = NewStr
    txtOutput.Text = vFront & vBack
    Case Is = 0
    vFront1 = Left$(Text9.Text, Val(txtStart(0).Text) - 1)
    vBack1 = Right$(Text9.Text, Val(Text10.Text) - Val(txtStart(0).Text) + 1)
    For i = 1 To txtWidth(0).Text
        vBack1 = a & vBack1
        NewStr = NewStr & txtFillChr.Text
    Next i
    txtData(0).Text = NewStr
    txtOutput.Text = vFront1 & vBack1
    End Select

End Sub

'==================================================================================================
'Sub ReadLinebyLine()
'Dim nHandle
'Dim TextLine
'    nHandle = FreeFile
'    Open txtFilePath.Text For Input Access Read As #nHandle
'    Do While Not EOF(nHandle)
'    Line Input #nHandle, TextLine
'    Text1.Text = TextLine
'    Loop
'    Close #nHandle
'End Sub
'==================================================================================================
Private Sub cmdAdd_Click()
Dim Index_No, i As Integer
Dim vFront, vBack, a, NewStr As String

    If Index_No <= 11 Then
        Index_No = txtStart.Count
        Load txtStart(Index_No)
    End If
    If txtStart.Count <= 11 Then
        txtStart(Index_No).Top = (txtStart(Index_No - 1).Top + 25) + (txtStart(Index_No - 1).Height + 25)
    ElseIf txtStart.Count > 5 And txtStart.Count <= 11 Then
        'txtStart(Index_No).Left = txtStart(0).Width + 500
        txtStart(Index_No).Top = txtStart(Index_No - 5).Top
    Else
        MsgBox "Limit Over Adding TextBox!", vbInformation + vbOKOnly, App.Title
    End If
    txtStart(Index_No).Text = ""
    txtFillChr.Text = ""
    ClearCheckBoxes
    txtStart(Index_No).Visible = True
    txtStart(Index_No).Enabled = True
    Call chkFill_Click
    If txtStart.Count = 12 Then
        Unload txtStart(11)
    End If
    Me.Refresh

    If Index_No <= 11 Then
        Index_No = txtWidth.Count
        Load txtWidth(Index_No)
    End If
    If txtData.Count <= 11 Then
        txtWidth(Index_No).Top = (txtWidth(Index_No - 1).Top + 25) + (txtWidth(Index_No - 1).Height + 25)
    ElseIf txtWidth.Count > 5 And txtWidth.Count <= 11 Then
        'txtStart(Index_No).Left = txtStart(0).Width + 500
        txtWidth(Index_No).Top = txtWidth(Index_No - 5).Top
    'Else
    '    MsgBox "Limit Over Adding TextBox!", vbInformation + vbOKOnly, App.Title
    End If
    txtWidth(Index_No).Text = ""
    txtWidth(Index_No).Visible = True
    txtWidth(Index_No).Enabled = True
    If txtWidth.Count = 12 Then
        Unload txtWidth(11)
    End If
    Me.Refresh

    If Index_No <= 11 Then
        Index_No = txtData.Count
        Load txtData(Index_No)
    End If
    If txtData.Count <= 11 Then
        txtData(Index_No).Top = (txtData(Index_No - 1).Top + 25) + (txtData(Index_No - 1).Height + 25)
    ElseIf txtData.Count > 5 And txtData.Count <= 11 Then
        'txtStart(Index_No).Left = txtStart(0).Width + 500
        txtData(Index_No).Top = txtData(Index_No - 5).Top
    'Else
    '    MsgBox "Limit Over Adding TextBox!", vbInformation + vbOKOnly, App.Title
    End If
    txtData(Index_No).Text = ""
    txtData(Index_No).Visible = True
    txtData(Index_No).Enabled = True
    If txtData.Count = 12 Then
        Unload txtData(11)
    End If
    Me.Refresh

End Sub

'==================================================================================================
Sub ClearCheckBoxes()
    chkFill(0).Value = False
    chkFill(1).Value = False
End Sub

in my code, i don't know how to show the data from the array textbox...any idea?

Edited 2 Years Ago by nayzin.phyo: wrong

This article has been dead for over six months. Start a new discussion instead.