473,657 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File handling in VB


hi am new to VB. I need to develop an application. The requirements are
as follows:

We have a notepad which consists of some data(Say A). Now we have a
form in which we have some text fields & a command button. when we
click cmd button once the data from the notepad should be read as
strings of different sizes & displayed in the text boxes. Again when we
click the cmd button the data in various text fields are written to
another notepad(say B) after creating it & again the remaining data is
read from the file A from the last position .

also i need a way to search for an unique string in notepad B from the
form & edit details around that string in file B.

Pls help me.....i need this only in VB no other scripting as i don know
about scripting.

Also if anyone can tell me link where i can get details regarding file
handling in detail in VB..i will b very helpful..

Oct 10 '06 #1
3 1861

Binu C wrote:
hi am new to VB. I need to develop an application. The requirements are
as follows:

We have a notepad which consists of some data(Say A). Now we have a
form in which we have some text fields & a command button. when we
click cmd button once the data from the notepad should be read as
strings of different sizes & displayed in the text boxes. Again when we
click the cmd button the data in various text fields are written to
another notepad(say B) after creating it & again the remaining data is
read from the file A from the last position .

also i need a way to search for an unique string in notepad B from the
form & edit details around that string in file B.

Pls help me.....i need this only in VB no other scripting as i don know
about scripting.

Also if anyone can tell me link where i can get details regarding file
handling in detail in VB..i will b very helpful..
I would be surprised if anyone actually wrote some code for you. You
request is how to do very basic types of operations that even a
beginning program should either know or know how to figure out. I
strongly suggest spending a few days studing the help, go buy a book on
VB, and do a few Google searches for sample code.

Oct 10 '06 #2
everyone has to start somewhere!

something like this should help get you started:

'reading in the first file
Dim oFile As System.IO.File
Dim oRead As System.IO.Strea mReader
Dim LineIn As String
oRead = oFile.OpenText( Me.txtbox.Text) ' textbox where the file name
is
While oRead.Peek <-1
'do what you want here
' i.e. stream writer
end while

za***@construct ion-imaging.com wrote:
Binu C wrote:
hi am new to VB. I need to develop an application. The requirements are
as follows:

We have a notepad which consists of some data(Say A). Now we have a
form in which we have some text fields & a command button. when we
click cmd button once the data from the notepad should be read as
strings of different sizes & displayed in the text boxes. Again when we
click the cmd button the data in various text fields are written to
another notepad(say B) after creating it & again the remaining data is
read from the file A from the last position .

also i need a way to search for an unique string in notepad B from the
form & edit details around that string in file B.

Pls help me.....i need this only in VB no other scripting as i don know
about scripting.

Also if anyone can tell me link where i can get details regarding file
handling in detail in VB..i will b very helpful..

I would be surprised if anyone actually wrote some code for you. You
request is how to do very basic types of operations that even a
beginning program should either know or know how to figure out. I
strongly suggest spending a few days studing the help, go buy a book on
VB, and do a few Google searches for sample code.
Oct 10 '06 #3
jo***********@g mail.com wrote:
'reading in the first file
Dim oFile As System.IO.File
Dim oRead As System.IO.Strea mReader
Dim LineIn As String
oRead = oFile.OpenText( Me.txtbox.Text) ' textbox where the file name
is
While oRead.Peek <-1
'do what you want here
' i.e. stream writer
end while
Creating an instance of the File object is not necessary as the
OpenText method is Shared.

Dim oRead As System.IO.Strea mReader
Dim LineIn As String

oRead = File.OpenText(M e.txtbox.Text)

Oct 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3198
by: Hans-Joachim Widmaier | last post by:
Hi all. Handling files is an extremely frequent task in programming, so most programming languages have an abstraction of the basic files offered by the underlying operating system. This is indeed also true for our language of choice, Python. Its file type allows some extraordinary convenient access like: for line in open("blah"): handle_line(line)
1
3261
by: Sean W. Quinn | last post by:
Hey folks, I have a question regarding file handling, and the preservation of class structure. I have a class (and I will post snippets of code later in the post) with both primitive data structures (ints), and more complex data structures (strings and vectors) in it, and would like to write the entire class to a data file that could then be read back and loaded. However I'm having difficulty with this -- I found out (due to an...
5
2282
by: John Douglass | last post by:
I'm fairly new to doing involved file i/o and I came across something weird with a program I'm writing (modifying MIDI data, if it makes any difference). With some input files, when I modify data and then output to a new file, the program will crash. The catch is that when I open up the output file to see what the program managed to write, it always makes it to an offset of xFFF. For example, with one file it crashed at 2FFF, another at...
8
26708
by: Gabe Moothart | last post by:
Hi, I'm writing a windows service which interacts with a separate process. Basically, it calls a process which creates a file, and then my service reads that file. The problem is, the external process can take a second or two to finish writing the file. If I try to read the file to soon, I get an exception that "The process cannot access the file because it is being used by another process". I could just set a timer, but the time it...
14
3882
by: Al Smith | last post by:
I need help in implementing proper error handling. I am trying to upload a file based on the sample code below. The code works well except if the file selected is too big. I do know about the maxRequestLength parameter of the <httpRuntime> section and that works as expected. What I want is to enforce a max file size but haven't been able to trap the error thrown when the file is too large and that's where I could use some help.
1
6476
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
5
4060
by: Digital Puer | last post by:
I fixed a bug today that went against my intuition. I am on Linux. I had a class that fopen'ed some files. When I called delete on these objects, I expected that the files would be closed automatically, just as when an application terminates, but evidently this is not the case. I guess I have to fclose the files in the destructor. Is this a correct assessment?
19
4768
by: rmr531 | last post by:
First of all I am very new to c++ so please bear with me. I am trying to create a program that keeps an inventory of items. I am trying to use a struct to store a product name, purchase price, sell price, and a taxable flag (a Y/N char) and then write this all out to a file (preferably just a plain old text file) and then read it in later so that I can keep a running inventory. The problem that I am running into is when I write to the...
5
64620
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming. FYI Although I have called this article “How to Parse a File in C++”, we are actually mostly lexing a file which is the breaking down of a stream in to its component parts, disregarding the syntax that stream contains. Parsing is actually including the syntax in order to make...
5
6803
by: kailashchandra | last post by:
I am trying to upload a file in php,but it gives me error msg please Help me? My Code is like below:- i have one php file named upload.php and i have another html file named upload.html and inside html i am calling php file upload.php:- <?php
0
8844
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8518
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7354
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5643
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
4173
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
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.