473,651 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Saving user prefernces ( slider . check boxes... )

Hello,

I want to save the position of all the controls on my form. I would like to
write them out to a preference file.

I have done this in DOS BASIC like this:

TO WRITE the preference
open "c:\preferences .txt" for input as #1
input #1 ,a,b,c
close #1

TO READ the preferences
open "c:\preferences .txt" for output as #1
write #1,a,b,c
c lose #1

What are the VB.NET commands to do this ?
Thanks
Dan
Nov 20 '05 #1
15 1505
Hi try This,

Dim c As Control
Dim sw As StreamWriter = File.CreateText ("C:\PREF.TX T")

For Each c In Me.Controls
sw.WriteLine(c. Name & ":" & c.Location.ToSt ring())
Next

sw.Close()

Produces something like this.

Button1:{X=56,Y =56}
RadioButton1:{X =176,Y=240}
CheckBox1:{X=88 ,Y=184}
TextBox1:{X=72, Y=128}

Regards - OHM

Dan DeConinck wrote:
Hello,

I want to save the position of all the controls on my form. I would
like to write them out to a preference file.

I have done this in DOS BASIC like this:

TO WRITE the preference
open "c:\preferences .txt" for input as #1
input #1 ,a,b,c
close #1

TO READ the preferences
open "c:\preferences .txt" for output as #1
write #1,a,b,c
c lose #1

What are the VB.NET commands to do this ?
Thanks
Dan


--
Best Regards - OHM

O_H_M{at}BTInte rnet{dot}com
Nov 20 '05 #2
Hi,

http://msdn.microsoft.com/library/de...et02122002.asp

http://msdn.microsoft.com/library/de...et07082003.asp

Ken
----------------
"Dan DeConinck" <pi********@sym patico.ca> wrote in message
news:m8******** ************@ne ws20.bellglobal .com...
Hello,

I want to save the position of all the controls on my form. I would like
to
write them out to a preference file.

I have done this in DOS BASIC like this:

TO WRITE the preference
open "c:\preferences .txt" for input as #1
input #1 ,a,b,c
close #1

TO READ the preferences
open "c:\preferences .txt" for output as #1
write #1,a,b,c
c lose #1

What are the VB.NET commands to do this ?
Thanks
Dan

Nov 20 '05 #3
* "One Handed Man [ OHM# ]" <O_H_M{at}BTInt ernet{dot}com> scripsit:
Produces something like this.

Button1:{X=56,Y =56}
RadioButton1:{X =176,Y=240}
CheckBox1:{X=88 ,Y=184}
TextBox1:{X=72, Y=128}


And how to read this data?

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Your such a smart*ss sometimes Herfreid, this is just an example, he can CSV
it or something

:)

OHM

Herfried K. Wagner [MVP] wrote:
* "One Handed Man [ OHM# ]" <O_H_M{at}BTInt ernet{dot}com> scripsit:
Produces something like this.

Button1:{X=56,Y =56}
RadioButton1:{X =176,Y=240}
CheckBox1:{X=88 ,Y=184}
TextBox1:{X=72, Y=128}


And how to read this data?

;-)


--
Best Regards - OHM

O_H_M{at}BTInte rnet{dot}com
Nov 20 '05 #5
Cor
Hi OHM,

There was I time that I had fun prickling Herfried with that kind of answers
he did do to you. I stopped with it, I thought in the time of the Fergus <->
Herfried battle.

What do you think if I start it again a while and then we do it together
(Armin does it still sometimes)?

Cor
Nov 20 '05 #6
OK, why not, its about time that someone did this :), but dont tell anyone
as I dont want them to know OK!

:)

Regards - OHM

Cor wrote:
Hi OHM,

There was I time that I had fun prickling Herfried with that kind of
answers he did do to you. I stopped with it, I thought in the time of
the Fergus <-> Herfried battle.

What do you think if I start it again a while and then we do it
together (Armin does it still sometimes)?

Cor


--
Best Regards - OHM

O_H_M{at}BTInte rnet{dot}com
Nov 20 '05 #7
With some embarrasement, I have to admit I was thinking of asking the same
question, but not with any smartss tendency :-) so let me phrase it a
little differently...

I'm still kinda new to programming, and I am designing a new CF project
where I want to add standard controls at runtime, using some type of file
to store the control(s) names, types, location, content (comboboxes,
textboxes), state (radiobuttons, checkboxes), etc.

Users may edit these through my program, so when the program closes, I'll
probably update the file if needed.

The OP asked (more specifically) about writing a preference file; is this
the best approach for storing and uploading control info to be used at
runtime, or are there better built-in functions that I don't know about? Or
are there other (easier) ways to do the same, including possibly saving an
XML file with the same information? I assume I would be looking at the
form.load area of the program to open the file and pull in the information,
and use it to create the controls...

Even giving me an idea of where to look in the VS helpfile (VB.net) would
be great, I simply don't know enough yet to "know what I don't know"

Humbly,
Keith
One Handed Man [ OHM# ] <O_H_M{at}BTInt ernet{dot}com> wrote in article
<OW************ **@TK2MSFTNGP09 .phx.gbl>...
Your such a smart*ss sometimes Herfreid, this is just an example, he can CSV it or something

:)

OHM

Herfried K. Wagner [MVP] wrote:
* "One Handed Man [ OHM# ]" <O_H_M{at}BTInt ernet{dot}com> scripsit:
Produces something like this.

Button1:{X=56,Y =56}
RadioButton1:{X =176,Y=240}
CheckBox1:{X=88 ,Y=184}
TextBox1:{X=72, Y=128}


And how to read this data?

;-)


--
Best Regards - OHM

O_H_M{at}BTInte rnet{dot}com

Nov 20 '05 #8
* "One Handed Man [ OHM# ]" <O_H_M{at}BTInt ernet{dot}com> scripsit:
Your such a smart*ss sometimes Herfreid, this is just an example, he can CSV
it or something


I included a ";-)".

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #9
Cor
Hi Keith,

I was also looking at this question but the OP did ask it in a very
specific way, which I did not know how to give an answer on but OHM did.

I saw that Herfried had also a question about this, but I think there is a
better approach.

If that does not answer the question from Herfried I will look if I can help
him with his problem how to read such a file.

To give you a more direct answer, the most simple way to save this settings
is in the registry or in an XML file.

Although it looks difficult a dataset is very simple to make (I did give a
lot of samples the last days with it in this newsgroup but if you need it I
can do it again).

That dataset you can easely writen with mydatset.writex ml(mypath) and read
with mydataset.readx ml(mypath)

If hope this helps, and if not feel free to ask?

Cor
Nov 20 '05 #10

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

Similar topics

1
2288
by: Israel | last post by:
The problem: I want to know, definitively when a slider loses focus after a user has started sliding and hasn't released the mouse yet. It appears that this is captured with the WM_ACTIVATEAPP message but this only goes to the form and I want it in the user control that maybe very much removed from the form's knowledge; i.e. the form may launch a 3rd party form that, upon a call back, decides to launch other form that has my user control...
4
6718
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my code ?? thank you Pedro Leite From Portugal ------------------------------------
4
1958
by: bill | last post by:
How can I create a slider control or visual scale control which fires a server-side event when a selection is made? I would appreciate any tips. Thanks Bill
3
1765
by: Nathan Guill | last post by:
I have an interface that works with an Access back-end. I would like to store and/or load user defined query strings per each user (i.e. no user can access another's queries). The idea I had was a "table" stored with the C# front-end (not in the Access database), but don't know if this is even possible. If it is, can someone let me know how? Otherwise, how do other people handle storing and loading query strings for possible later use?
1
1621
by: theJonster | last post by:
Hi, I have created a page with a list of items and next to these items are comment boxes and check boxes which were dynamically created like this: check = new CheckBox(); check.ID = "Chk" + checkcount; if (dr.ToString() == "True") {
20
3721
by: fatfatpopo | last post by:
Anyone who understand the codes below, can you please kindly explain to me by adding comments.. thanks in advance // <applet code="ImageSlider" width="400" height="400"></applet> import java.awt.*; import java.awt.image.BufferedImage; import java.io.*; import javax.imageio.ImageIO; import javax.swing.*;
10
1294
by: =?Utf-8?B?VGhyb3dtZSBBIEZyaWdnaW5ib25l?= | last post by:
I apologize if this is in the wrong discussion group. I have a C++ form (VS2003) that includes a couple text boxes and a slider bar. Moving the slider bar changes a picture that is displayed and some label elements and the text boxes have an initial value of 0. When a value is typed into the text boxes I want it to be saved based on the position of the slider bar. I am assuming that I need to write that text to the array, but I am not sure...
6
3091
by: cmgmyr | last post by:
Hello, I'm trying to figure out how to disable a slider through the onChange function. Here is what I have so far: new Control.Slider('handle','slider', { axis:'horizontal', sliderValue: 1, range: $R(1, 100), alignY:0,
0
8352
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
8697
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
8465
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
8579
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...
0
7297
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
5612
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
4144
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...
1
2699
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
1587
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.