473,509 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Class controling form settings

I am wondering if it is possible to make something like the following work:

Public Class myTestSettings
Public Property onTop() As Boolean
Get
Return Form1.CheckBox1.Checked
End Get
Set(ByVal Value As Boolean)
Form1.CheckBox1.Checked = Value
End Set
End Property
End Class

Second question: if it is possible, is it advisable?

I am wanting to serialize this information to an XML file. I'm exploring
this as a possibly better way to accomplish this.

Thanks in advance,

Matthew
Nov 21 '05 #1
6 1169
Matthew,

In my opinion it makes no sense at all and makes your program only more
unreadable.
It is an extention to set the checkbox1 or form 1 in a hidden way while you
only want to set the setting in a config (XML) file (although for this kinds
of often done things I would normaly choose the registry when it has to be
saved).

The registry for computer dependend savings of settings.
The config for general saving of settings.
(As well when you have a situation where the user is using 2 or more
computers, however than it is directly not more computer dependend)

Just my thought,

Cor

"Matthew" <tu*************@alltel.net>
I am wondering if it is possible to make something like the following work:

Public Class myTestSettings
Public Property onTop() As Boolean
Get
Return Form1.CheckBox1.Checked
End Get
Set(ByVal Value As Boolean)
Form1.CheckBox1.Checked = Value
End Set
End Property
End Class

Second question: if it is possible, is it advisable?

I am wanting to serialize this information to an XML file. I'm exploring
this as a possibly better way to accomplish this.

Thanks in advance,

Matthew

Nov 21 '05 #2
Matthew,

In my opinion it makes no sense at all and makes your program only more
unreadable.
It is an extention to set the checkbox1 or form 1 in a hidden way while you
only want to set the setting in a config (XML) file (although for this kinds
of often done things I would normaly choose the registry when it has to be
saved).

The registry for computer dependend savings of settings.
The config for general saving of settings.
(As well when you have a situation where the user is using 2 or more
computers, however than it is directly not more computer dependend)

Just my thought,

Cor

"Matthew" <tu*************@alltel.net>
I am wondering if it is possible to make something like the following work:

Public Class myTestSettings
Public Property onTop() As Boolean
Get
Return Form1.CheckBox1.Checked
End Get
Set(ByVal Value As Boolean)
Form1.CheckBox1.Checked = Value
End Set
End Property
End Class

Second question: if it is possible, is it advisable?

I am wanting to serialize this information to an XML file. I'm exploring
this as a possibly better way to accomplish this.

Thanks in advance,

Matthew

Nov 21 '05 #3

"Matthew" <tu*************@alltel.net> wrote
I am wondering if it is possible to make something like the following work: <snipped for brievity>

Yes, it is possible.
Second question: if it is possible, is it advisable?


I'd sugggest it is not advisable. If you need a property to indicate what
the state of a control is, then you should make it a property of the form
the control is on, rather than calling into the form from some other module.

The main reason is to maintain encapsulation. Outside code could care
less what the name of the control is, the name is only relavent to the form
it is on. What they do care about is the user's selection for that option.
You can expose the state (value) without having to expose the control.

LFS
Nov 21 '05 #4

"Matthew" <tu*************@alltel.net> wrote
I am wondering if it is possible to make something like the following work: <snipped for brievity>

Yes, it is possible.
Second question: if it is possible, is it advisable?


I'd sugggest it is not advisable. If you need a property to indicate what
the state of a control is, then you should make it a property of the form
the control is on, rather than calling into the form from some other module.

The main reason is to maintain encapsulation. Outside code could care
less what the name of the control is, the name is only relavent to the form
it is on. What they do care about is the user's selection for that option.
You can expose the state (value) without having to expose the control.

LFS
Nov 21 '05 #5
Cor,

Thanks for your response.

Perhaps it would help if I explained a bit more. In this application, the
user is allowed to save the program state in an XML file. Then, they change
several settings. Then, they save that program state in a different XML
file.
At any time they can restore the program to a previous state. This is a
critical part of my program.

This situation seems to lend itself to separate config files rather than the
registry.
Does this sound true to you too?

Matthew
Nov 21 '05 #6
Matthew,

I understand now, what you are up to.

In my opinion can a dataset probably do a good job in that.

Easy to handle and easy to write as XML file.
You can than choose between different rows for the state (and even when you
make a centralized one, for each user a table).

Only you should not set it in the way you do, although it looks almost the
same, something as this however see it as pseudo

\\\
Public Class myTestSettings
private mydatarowitem as boolean =
ds.tables(thisuser).rows(last).("mycheckboxpropert yOnTop")
Public Property onTop() As Boolean
Get
Return mydatarowitem
End Get
Set(ByVal Value As Boolean)
mydatarowitem = Value
End Set
End Property
End Class
////
Use
Form1.CheckBox1.Checked = mytestS.OnTop
mytest.Ontop = .........................

Because that I have to go fast typed here just to give you an idea and not
really complete.

Cor

Nov 21 '05 #7

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

Similar topics

17
25385
by: Lauren Wilson | last post by:
Hi folks, Can someone point me to some resources on how to control FTP sessions from and Access application with VBA? Many thanks for all help. --LW.
10
3453
by: Not Available | last post by:
On the host server: namespace JCart.Common public class JCartConfiguration : IConfigurationSectionHandler private static String dbConnectionString; public static String ConnectionString { get...
2
1274
by: Aung | last post by:
I have two classes under the same namespace. something like this: class1 ~~~~~ namespace myProject { class myUI { public System.Windows.Forms.Label lblStatus;
1
7079
by: Jim | last post by:
Have fully operational software package developed on VB.NET that worked until Jan 1 2003, with early stage deployments on Oct 10, Oct 23, Nov 11, Dec 12 and Dec 30. When attempted final...
0
761
by: Matthew | last post by:
I am wondering if it is possible to make something like the following work: Public Class myTestSettings Public Property onTop() As Boolean Get Return Form1.CheckBox1.Checked End Get Set(ByVal...
0
6570
by: Herman Jones | last post by:
I'm getting the following error when I build a Class Library project: Embedding manifest... Project : error PRJ0002 : Error result 1 returned from 'C:\WINDOWS\system32\cmd.exe'. It happens with...
16
1754
by: Robert Dufour | last post by:
Here's the class code snippet Imports System.Configuration.ConfigurationManager Public Class Class1 Public _strTestSetting As String Public Sub SetTestsetting()
7
1621
by: Jon Slaughter | last post by:
I have some static fields in a class to keep track of "global" information but this information is local to each form that the class is used on. e.g., the class represents a base...
0
1210
by: Sid Price | last post by:
I have a custom provider in my application for saving settings. In addition to the main project there is also a class library with a form or two and we need to use the same config file through our...
0
7233
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,...
0
7342
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,...
0
7410
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...
0
5650
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,...
1
5060
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...
0
3215
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...
0
3201
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
440
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...

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.