Consulting

Results 1 to 2 of 2

Thread: Solved: retrive vlaue from batfile and inset in textbox

  1. #1
    VBAX Contributor
    Joined
    May 2008
    Location
    bangalore
    Posts
    199
    Location

    Solved: retrive vlaue from batfile and inset in textbox

    i need to retrieve value from bat file and place the path in textbox.
    i have 3 forms and per form 4 textbox

    i want to use vb.6 code to do retrieve the values..
    text1,text2,text3,text4 in form 1

    text1.text=d:\folder1\Images\10.dwg
    text2.text=d:\folder1\Images\11.dwg
    text3.text=e:\folder3\Images\13.dwg
    text4.text=e:\folder3\Images\14.dwg

    and text5.text,text6,text7 in form 2
    text5.text=e:\folder3\Images\15.dwg
    text6.text=e:\Images\16.dwg
    text7.text=f:\18.dwg;

    ex in bat file
    C:\Documents and Settings\Desktop\DWG6\IMAGE.exe d:\folder1\Images\10.dwg;d:\folder1\Images\11.dwg;e:\folder3\Images\13.dwg; e:\folder3\Images\14.dwg;e:\folder3\Images\15.dwg;e:\Images\16.dwg;f:\18.dw g;dim:off;sin:off;syd:on

  2. #2
    VBAX Contributor
    Joined
    May 2008
    Location
    bangalore
    Posts
    199
    Location
    solved the problem

    private Sub Command1_Click()
    
    Dim strInputString      As String
        Dim strFilterText       As String
        Dim astrSplitItems()    As String
        Dim astrFilteredItems() As String
        Dim strFilteredString   As String
        Dim intX                As Integer
    
    ' Get a free file number
    nFileNum = FreeFile
    
    ' Open a text file for input. inputbox returns the path to read the file
    Open "C:\1.bat" For Input As nFileNum
    lLineCount = 1
    ' Read the contents of the file
    Do While Not EOF(nFileNum)
       Line Input #nFileNum, sNextLine
       'do something with it
       'add line numbers to it, in this case!
       sNextLine = sNextLine & vbCrLf
       sText = sText & sNextLine
    
    Loop
    
                                  
               strInputString = sText 
         
     
        astrSplitItems = Split(strInputString, ";")
        For intX = 0 To UBound(astrSplitItems)
         
         Text1.Text = astrSplitItems(1)
         Text2.Text = astrSplitItems(2)
         Text3.Text = astrSplitItems(3)
         Text4.Text = astrSplitItems(4)
            Next
     Close the file
    Close nFileNum

Posting Permissions

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