hi
the settings of my program are stored in an ini file, is there a simple way
to open the file in some textbox, ore a betteer soutable box.
i also want it to be able to resave the ini so people can modifi the ini.
an example is the program mysql (meightbe someone has seen it)
that's exatly wath i'm trying to do.
thank you . 8 9758
On Mon, 13 Sep 2004 10:12:22 +0200, "Gurk" <gu******@hotma il.com>
wrote: hi
the settings of my program are stored in an ini file, is there a simple way to open the file in some textbox, ore a betteer soutable box.
i also want it to be able to resave the ini so people can modifi the ini.
an example is the program mysql (meightbe someone has seen it) that's exatly wath i'm trying to do.
thank you .
Public Sub FileStr(Fle$, S$)
Dim Handle As Integer
S$ = ""
On Error Resume Next
S$ = Space(FileLen(F le$))
On Error GoTo 0
If Len(S$) > 0 Then
Handle = FreeFile
Open Fle$ For Binary Access Read As Handle
Get #Handle, , S$
Close #Handle
End If
End Sub
Note that the above code does not care whether the file exists
Public Sub StrFile(S$, Fle$)
Dim Handle As Integer
Handle = FreeFile
Open Fle$ For Output As Handle
Print #Handle, S$;
Close #Handle
End Sub
"J French" <er*****@nowher e.com> wrote in message
news:41******** *******@news.bt click.com... On Mon, 13 Sep 2004 10:12:22 +0200, "Gurk" <gu******@hotma il.com> wrote:
hi
the settings of my program are stored in an ini file, is there a simple
wayto open the file in some textbox, ore a betteer soutable box.
i also want it to be able to resave the ini so people can modifi the ini.
an example is the program mysql (meightbe someone has seen it) that's exatly wath i'm trying to do.
thank you .
Public Sub FileStr(Fle$, S$)
Dim Handle As Integer
S$ = ""
On Error Resume Next S$ = Space(FileLen(F le$)) On Error GoTo 0 If Len(S$) > 0 Then Handle = FreeFile Open Fle$ For Binary Access Read As Handle Get #Handle, , S$ Close #Handle End If
End Sub
Note that the above code does not care whether the file exists
Public Sub StrFile(S$, Fle$)
Dim Handle As Integer
Handle = FreeFile Open Fle$ For Output As Handle Print #Handle, S$; Close #Handle
End Sub
thank you for the reply
but when i open it, i get an error
path/file acces error, when i debug it marks this line.
Open Fle$ For Binary Access Read As Handle
and mightbe a stupid question, but where does it print the ini.
i dit this:
Public Sub FileStr(Fle$, S$)
Dim Handle As Integer
S$ = "c:\windows\PLC .ini"
On Error Resume Next
S$ = Space(FileLen(F le$))
On Error GoTo 0
If Len(S$) > 0 Then
Handle = FreeFile
Open Fle$ For Binary Access Read As Handle
Get #Handle, , S$
Text1.Text = Handle
Close #Handle
End If
End Sub
thank you
ok i think i'm getting there, ive changed something in the code, it now
looks like this:
Public Sub FileStr(Fle$, S$)
Dim Handle As Integer
S$ = "c:\windows\PLC .ini"
On Error Resume Next
S$ = Space(FileLen(F le$))
On Error GoTo 0
If Len(S$) > 0 Then
Handle = FreeFile
Open S$ For Binary Access Read As Handle
Get #Handle, , S$
Text1.Text = (S$)
Close #Handle
End If
End Sub
but it only showes the first 2 lines of the ini, and
a space is shown as ||.
how comes??
thanks Maarten
"Gurk" <gu******@hotma il.com> wrote in message
news:41******** *************** @news.skynet.be ... "J French" <er*****@nowher e.com> wrote in message news:41******** *******@news.bt click.com... On Mon, 13 Sep 2004 10:12:22 +0200, "Gurk" <gu******@hotma il.com> wrote:
hi
the settings of my program are stored in an ini file, is there a simple wayto open the file in some textbox, ore a betteer soutable box.
i also want it to be able to resave the ini so people can modifi the
ini. an example is the program mysql (meightbe someone has seen it) that's exatly wath i'm trying to do.
thank you .
Public Sub FileStr(Fle$, S$)
Dim Handle As Integer
S$ = ""
On Error Resume Next S$ = Space(FileLen(F le$)) On Error GoTo 0 If Len(S$) > 0 Then Handle = FreeFile Open Fle$ For Binary Access Read As Handle Get #Handle, , S$ Close #Handle End If
End Sub
Note that the above code does not care whether the file exists
Public Sub StrFile(S$, Fle$)
Dim Handle As Integer
Handle = FreeFile Open Fle$ For Output As Handle Print #Handle, S$; Close #Handle
End Sub
thank you for the reply
but when i open it, i get an error path/file acces error, when i debug it marks this line.
Open Fle$ For Binary Access Read As Handle
and mightbe a stupid question, but where does it print the ini. i dit this:
Public Sub FileStr(Fle$, S$)
Dim Handle As Integer
S$ = "c:\windows\PLC .ini"
On Error Resume Next S$ = Space(FileLen(F le$)) On Error GoTo 0 If Len(S$) > 0 Then Handle = FreeFile Open Fle$ For Binary Access Read As Handle Get #Handle, , S$ Text1.Text = Handle Close #Handle
End If
End Sub
thank you
ok heres how to read a file into a textbox.
1) make sure the text box property MultiLine is set to True.
2) Scroll Bars Property is set to vbBoth
Private Sub ReadFile(ByVal FileName As String) 'FileName is the path & name
of the File i.e. "c:\myIniFile.i ni"
Dim FileNumber As Long
Dim sData As String
FileNumber = FreeFile
Open FileName For Input As #FileNumber
Do While Not EOF(FileNumber)
Line Input #FileNumber, Line_Data
sData = sData & Line_Data & vbCrLf
Loop
Close #FileNumber
TxtTest.Text = sData
End Sub
'---------------------------------------------
Private Sub SaveFile (byVal FileName as string) 'FileName is the path & name
of the File i.e. "c:\myIniFile.i ni"
'Save the file
Dim FileNumber as long
Dim sData as string
sData = text1.text 'Text that contains the ini file to be saved
Open FileName for Output as #FileNumber
Print#FileNumbe r, sData
Close#FileNumbe r
End Sub
' I haven't tested this but it looks good, please tell me if you can't get
it to work i will walk you through it.
"Gurk" <gu******@hotma il.com> wrote in message
news:41******** *************** @news.skynet.be ... hi
the settings of my program are stored in an ini file, is there a simple way to open the file in some textbox, ore a betteer soutable box.
i also want it to be able to resave the ini so people can modifi the ini.
an example is the program mysql (meightbe someone has seen it) that's exatly wath i'm trying to do.
thank you .
> ok heres how to read a file into a textbox. 1) make sure the text box property MultiLine is set to True. 2) Scroll Bars Property is set to vbBoth
Private Sub ReadFile(ByVal FileName As String) 'FileName is the path
& name of the File i.e. "c:\myIniFile.i ni" Dim FileNumber As Long Dim sData As String FileNumber = FreeFile Open FileName For Input As #FileNumber Do While Not EOF(FileNumber) Line Input #FileNumber, Line_Data
sData = sData & Line_Data & vbCrLf Loop Close #FileNumber TxtTest.Text = sData End Sub
This is routine is slightly better than yours as it reads the entire
file from the hard drive all at once instead of line-by-line.
Private Sub ReadFile(ByVal FileName As String)
Dim FileNum As Integer
Dim TotalFile As String
FileNum = FreeFile
' Reads the entire file into memory all at once
Open FileName For Binary As #FileNum
TotalFile = Space(LOF(FileN um))
Get #FileNum, , TotalFile
Text1.Text = TotalFile
Close #FileNum
End Sub
Rick - MVP
read ...
Dim hFile as Long
Dim sFilename as String
sFilename = "c:\demo.tx t"
'obtain the next free file handle from the system
'and load the file into the textbox
hFile = FreeFile
Open sFilename For Input As #hFile
Text1.Text = Input$(LOF(hFil e), hFile)
Close #hFile
write ...
Dim hFile as Long
Dim sFilename as String
sFilename = "c:\demo.tx t"
'obtain the next free file handle from the
'system and and save the text box contents
hFile = FreeFile
Open sFilename For Output As #hFile
Print #hFile, Text1.Text
Close #hFile
Note however that as this code simply loads a textbox for free editing, it
can not ensure the file written after the user interacts with it will have
maintained an INI-style, which your application may require (depending on
how its coded to read the files). If ensuring the strict adherence to the
INI format is required you must move to the INI APIs (easy as pie to use).
See http://vbnet.mvps.org/code/file/pprofilebasic.htm
--
Randy Birch
MS MVP Visual Basic http://vbnet.mvps.org/
"Gurk" <gu******@hotma il.com> wrote in message
news:41******** *************** @news.skynet.be ...
: hi
:
: the settings of my program are stored in an ini file, is there a simple
way
: to open the file in some textbox, ore a betteer soutable box.
:
: i also want it to be able to resave the ini so people can modifi the ini.
:
: an example is the program mysql (meightbe someone has seen it)
: that's exatly wath i'm trying to do.
:
: thank you .
:
:
"Gurk" <gu******@hotma il.com> skrev i en meddelelse
news:41******** *************** @news.skynet.be ... hi
the settings of my program are stored in an ini file, is there a
simple way to open the file in some textbox, ore a betteer soutable box.
Don't allow people to edet an ini file through your program ! They
will screw it up royally !
--
/\ preben nielsen
\/\ pr**@post.tele. dk
thank you all for the reply's
they al work fine and helped me a lot
greets Maarten
"Gurk" <gu******@hotma il.com> wrote in message
news:41******** *************** @news.skynet.be ... hi
the settings of my program are stored in an ini file, is there a simple
way to open the file in some textbox, ore a betteer soutable box.
i also want it to be able to resave the ini so people can modifi the ini.
an example is the program mysql (meightbe someone has seen it) that's exatly wath i'm trying to do.
thank you .
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: jas |
last post by:
Hi,
I would like to start a new process and be able to read/write from/to
it. I have tried things like...
import subprocess as sp
p = sp.Popen("cmd.exe", stdout=sp.PIPE)
p.stdin.write("hostname\n")
however, it doesn't seem to work. I think the cmd.exe is catching it.
|
by: jacob navia |
last post by:
In C, we have read-only memory (const), read/write memory
(normal data), and write only memory.
Let's look at the third one in more detail.
Write only memory is a piece of RAM that can only
be written to, since its contents are undefined.
The program is allocating a new piece of data, and
the previous contents aren't relevant. This memory
|
by: frekster |
last post by:
All.
I have a folder/files that I have added asp.net to have read/write/etc.
privlidges via the properties of the folder/files and security tab.
However, when I run my asp.net page, I still get that access is denied.
the path is c:\inetpub\app\bin\folder
the "folder has a ton of files in it and every file in the folder must
be able to be opened and binary read by the asp.net worker process.
|
by: Tibby |
last post by:
I need to read/write not only text files, but binary as well. It seems like on binary files, it doesn't right the last 10% of the file.
--
Thanks
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.538 / Virus Database: 333 - Release Date: 11/10/2003
|
by: Just Me |
last post by:
Using streams how do I write and then read a set of variables?
For example, suppose I want to write into a text file:
string1,string2,string3
Then read them later.
Suppose I want to write and then read:
string1, integer1, double1
| |
by: a |
last post by:
I have a struct to write to a file
struct _structA{
long x;
int y;
float z;
}
struct _structA A;
//file open
write(fd,A,sizeof(_structA));
//file close
|
by: Frederic Rentsch |
last post by:
Hi all,
Working with read and write operations on a file I stumbled on a
complication when writes fail following a read to the end.
30L
'abcdefg'
Traceback (most recent call last):
File "<pyshell#62>", line 1, in -toplevel-
|
by: vinothg |
last post by:
I have a binary file,which contains strings of 30 bytes each.I need to open the file,read the strings one by one and if the string is not found i need to write it.But unfortunately both read and write using fstream is not not working.If i close the file and open it again it works.
#include <iostream>
#include <sys/stat.h>
#include <fstream>
int main(){
fstream fs;
char write= {"A0000.label"};
|
by: asit dhal |
last post by:
hello friends,
can anyone explain me how to use read() write() function in C.
and also how to read a file from disk and show it on the monitor using
onlu read(), write() function ??????
|
by: Sachin Garg |
last post by:
I have a program which opens a fstream in binary input+output mode, creating
the file if it doesn't exists. But writing doesn't works after reading, it
must be something obvious that I am not aware of.
f.open(filename,ios::in | ios::out | ios::binary | ios::trunc)
The program flow is
1) write some data
2) read the data
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
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();...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |