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

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




retrive vlaue from bat file and inset in textbox vb.6

 
Reply to this topicStart new topic

retrive vlaue from bat file and inset in textbox vb.6

shamsam1
13 Oct, 2008 - 04:44 AM
Post #1

New D.I.C Head
*

Joined: 29 Feb, 2008
Posts: 3

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
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Retrive Vlaue From Bat File And Inset In Textbox Vb.6
13 Oct, 2008 - 04:53 AM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,009



Thanked: 126 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
User is offlineProfile CardPM
+Quote Post

shamsam1
RE: Retrive Vlaue From Bat File And Inset In Textbox Vb.6
13 Oct, 2008 - 05:39 AM
Post #3

New D.I.C Head
*

Joined: 29 Feb, 2008
Posts: 3

vb

Dim nFileNum As Integer, sText As String, sNextLine As String, lLineCount As Long

'==================================

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.txt" 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 = InputBox("Enter a comma-delimited string of items:", _
"String Array Functions")

strInputString = sText
' strFilterText = InputBox("Enter Filter:", "String Array Functions")

' Print "Original Input String: "; strInputString
' Print

' Print "Split Items:"
astrSplitItems = Split(strInputString, ";")
For intX = 0 To UBound(astrSplitItems)
'Print "item("; intX; "): "; astrSplitItems(intX)
Text1.Text = astrSplitItems(1)
Text2.Text = astrSplitItems(2)
Text3.Text = astrSplitItems(3)
Text4.Text = astrSplitItems(4)
Next
'Text1.Text = sText

' Close the file
Close nFileNum

End Sub


Mod Edit: Please use code tags when posting your code. Code tags are used like so => code.gif

Thanks,
PsychoCoder smile.gif
User is offlineProfile CardPM
+Quote Post

thava
RE: Retrive Vlaue From Bat File And Inset In Textbox Vb.6
13 Oct, 2008 - 07:22 AM
Post #4

D.I.C Regular
Group Icon

Joined: 17 Apr, 2007
Posts: 456



Thanked: 18 times
Dream Kudos: 50
My Contributions
try this
vb

Dim nFileNum As Integer, sText As String, sNextLine As String, lLineCount As Long

'==================================

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.txt" 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
'*************Corrected Line
sText = sText & "," & sNextLine
'*************Corrected Line

Loop

'strInputString = InputBox("Enter a comma-delimited string of items:", "String Array Functions")

strInputString = sText
' strFilterText = InputBox("Enter Filter:", "String Array Functions")

' Print "Original Input String: "; strInputString
' Print

' Print "Split Items:"
astrSplitItems = Split(strInputString, ";")
' *********if the file contains only four line then this code is not much wrong
Text1.Text = astrSplitItems(1)
Text2.Text = astrSplitItems(2)
Text3.Text = astrSplitItems(3)
Text4.Text = astrSplitItems(4)

'*********or else

For intX = 0 To UBound(astrSplitItems)
'Print "item("; intX; "): "; astrSplitItems(intX)
text1(intx).text = astrSplitItems(intX)
Next
'Text1.Text = sText

' Close the file
Close nFileNum

End Sub



This post has been edited by thava: 13 Oct, 2008 - 07:22 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/5/08 12:51AM

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