473,799 Members | 2,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to retrieve a certain text from .*txt file into textboxes?

3 New Member
;) Hi, I met with some problems with my Visual Basic codings...I need to retrieve certain texts or characters from the text file and place it in each different textboxes...How do i start with? :eek: ...Below is the text file which i needed to retrieve...I need to start reading from [status] to [status end]...How do i code in order to read them line-by-line and retrieving the each numbers into textboxes? :confused:

[Status]
Axis-1
0, 0, 1, 0, 0
300.25, 300.25
Axis-2
0, 0, 0, 0, 1
0, 0
Axis-3
0, 0, 0, 0, 0
50.50, 85.45
[Status End]
[Error]
Axis 1 reached forward limit
All axis at home position
[Error End]
Jul 20 '06 #1
4 2435
LifeEquals42
7 New Member
Maybe this can get you started

Dim strTemp As String

Open "C:\Test.tx t" For Input As #1
Input #1, strTemp
MsgBox strTemp
Close #1
Jul 20 '06 #2
joanjy86
3 New Member
Yup.. :D Thanks for your code, it really helps...but i need to retrieve the Axis-1, Axis-2, Axis-3...and without knowing how many axes are there in the text file..how do i retrieve the all Axis into each different textboxes? Because my programming language is weak...it would be of a great help if u could code it in a more simpler manner...Thanks alot... :)
Jul 21 '06 #3
joanjy86
3 New Member
Maybe this can get you started

Dim strTemp As String

Open "C:\Test.tx t" For Input As #1
Input #1, strTemp
MsgBox strTemp
Close #1
-------------------------------------------------------------------------------------------------------------------

Yup.. :D Thanks for your code, it really helps...but i need to retrieve the Axis-1, Axis-2, Axis-3...and without knowing how many axes are there in the text file..how do i retrieve the all Axis into each different textboxes? Because my programming language is weak...it would be of a great help if u could code it in a more simpler manner...Thanks alot.. :rolleyes: .
Jul 21 '06 #4
LifeEquals42
7 New Member
-------------------------------------------------------------------------------------------------------------------

Yup.. :D Thanks for your code, it really helps...but i need to retrieve the Axis-1, Axis-2, Axis-3...and without knowing how many axes are there in the text file..how do i retrieve the all Axis into each different textboxes? Because my programming language is weak...it would be of a great help if u could code it in a more simpler manner...Thanks alot.. :rolleyes: .

Well I think the focus of these forums is on learning this yourself by searching help files and internet but I will give you one more nudge in the right direction.

After you get the line of text you can test it with the InStr Function

example

Dim strTemp As String

Open "C:\Test.tx t" For Input As #1
Input #1, strTemp
MsgBox strTemp
Input #1, strTemp

'############## ############### #############
'Test to see if this line has the string "Axis-1"
If InStr(1, strTemp, "Axis-1", vbTextCompare) Then
MsgBox "This is the Axis-1 Line"
End If
'############## ############### #############

Input #1, strTemp
MsgBox strTemp
Input #1, strTemp
MsgBox strTemp
Input #1, strTemp
MsgBox strTemp
Close #1

each subsequent Input statement will give you the Axis-1 values
Jul 21 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

31
2228
by: J.S. | last post by:
Let's say I have a text file with parameters like the following embedded in the text: @@Textbox1@@, @@Textbox2@@, etc. Is it possible to replace the parameters in the text file with values entered into textboxes in the Windows Forms UI? Thanks, J.S.
17
2018
by: J.S. | last post by:
I have a text file with parameters like the following embedded in the text: @@TextBox1@@, @@TextBox2@@, etc. I know how to read this text file. However, I am trying to figure out how to replace these parameters in the text file with values of the textboxes on my Windows Form called Form1. For example, replace @@TextBox1@@ with value of TextBox1, replace @@TextBox2@@ with value of TextBox2, replace @@ComboBox1@@ with value of...
8
2844
by: Fabian Braennstroem | last post by:
Hi, I would like to remove certain lines from a log files. I had some sed/awk scripts for this, but now, I want to use python with its re module for this task. Actually, I have two different log files. The first file looks like: ...
5
18420
by: MoshiachNow | last post by:
HI, How do I force a browser to open a certain file with notepad ? <LI><A HREF="D:/Program Files/yohoLogFile.txt.4" ><p style="font-family:font-size: 7pt;"yohoLogFile.txt.4 </A></LI>'; Thanks
2
5925
by: phpachu | last post by:
Hi, I hav created a group of textboxes using a loop and its names are unique and names are assigned using variable ( like <input type=text name=$name1>). Then How can i retrieve the values in that textboxes after a button click with in a loop. Really I cant move from here. Can anyone plz help me.. Part of the my code is given below <html> <table> <?php // i hav an array "assocArray" and its count is "countarray" for($i = 1; $i <...
1
1650
by: Computernut234 | last post by:
Hi, i'm doing a project for my Java class and I know how to add text to a .txt document and remove the entire text but I do not know how to only remove certain parts of text. My code is supposed to allow users to add/remove text depending on the condition. The code is import java.io.*; import java.util.*; public class texteditor
1
2192
Dököll
by: Dököll | last post by:
Greetings, Good buddies! I am for the first time, since I started learning VB, going to build an application I wanted to build for my first son, a language and activities program that will allow at one push of a button for colours to be added in squares, circles, and for audio responses to these to sound when for example, red circles, blue squares, or foods, etc are found in text added to multiline textbox. My second son can benefit from...
2
1170
by: sasimca007 | last post by:
Hello friends, I have one critical doubt on textboxes. That is, I am using modperl and in that within one loop i am giving nof.of text boxes with different names like below: foreach $W($week1,$week2,$week3,$week4,$week5,$week6,$week7) { print "<td align=center><input type='text' name='$code-$testdate' id='reg_box_parent' value='$shcode' size=3 onkeyup='func(this.form,this.name)' maxlength=8>"; } ...
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.