Next Generation Emulation banner
1 - 20 of 38 Posts

·
Registered
Joined
·
598 Posts
Discussion Starter · #1 ·
Hey guys.Well for the past 3 years I was always interested WHAT KIND OF THE WAY the C# programmers use to save the changes in the application.Whether is that the check state of the check box control or radio button control or whatever......and then how to execute the function in the application when the state of the check box,(or any other control),is checked or unchecked.You know those popular buttons in Windows like OK,CANCEL and APPLY?Well my question is what way do you use for that APPLY button.So for example:

-You have the C# application with the check box and button whos text is
APPLY THE CHANGE
-You want to make that when the user clicks the APPLY button,the that
change in the check box is saved.Wether is the check box checked or
unchecked
-Also you want to make that after the user quits the application and then
turn it on again,the that change is automatically loaded in the C#
application and automatically shows that change--->CHECKED or
UNCHECKED check box control

So my question is...what kind of the way do YOU use to do something like
this???

Honestly I hate doing something like this using the XML,SQL or any other way that saves the changes in the Windows registry...
I made my own way which seems to work prefectly:D

But anyway...I would like to know YOUR way of doing something like this in C#.Wether is the version 2002,2003,2005 or 2008...
 

·
Registered
Joined
·
7,407 Posts
.... ugh.
 

·
You're already dead...
Joined
·
10,293 Posts
you can save an ini file with the options you want, and then load it at application boot-up.
that's my favorite way, since i think ini files are cool xD

there's also some very easy way to do this stuff in VB, but i don't remember how xD
 

·
Emu Author
Joined
·
616 Posts
it depends on the application i am designing, but the main thing is that i do it like an ini file even though 99% of the time i do not work with straight ini files lol.

but when my app boots up i load the settings from where ever the file i am working with is saved and i apply the changes to my controls.
 

·
Registered
Joined
·
598 Posts
Discussion Starter · #7 ·
Lol this will maybe sound funny,but I am using the simple rich text box to save the changes for ANY control I want.I do not use the XML,INI files or Windows registry.:D
My way of saving changes is a little bit strange lol,but it works perfectly.If you are interested,I can make a 5 minute video to show you how I did it.Of course if that's ok with you guys?
 

·
You're already dead...
Joined
·
10,293 Posts
I am using the simple rich text box to save the changes for ANY control I want.
i'm not sure i understand what you're doing.

do you mean write the settings to a hidden rich text box, and then save/load it to some file using a function?


oh wait....
are you even talking about saving/loading settings between application startup?
or are you just talking about saving settings while running the application?

in either case, a rich-text-box control seems like overkill.
at the very-least, you can use a String instead.
but one of the nicest ways (and the common way to do it) is to have a struct with the different application setting's data.

something like:

Code:
struct appData {
    bool option1;
    bool option2;
    int  option3;
}

appData mySettings; // Global Struct with the App's Settings
 

·
Registered
Joined
·
598 Posts
Discussion Starter · #9 ·
i'm not sure i understand what you're doing.

do you mean write the settings to a hidden rich text box, and then save/load it to some file using a function?


oh wait....
are you even talking about saving/loading settings between application startup?
or are you just talking about saving settings while running the application?
[/code]
I just recorded the video so everything will make all clear.In an hour I will give you guys the link to download the video.The damn upload process on the sendspace takes forever xD
 

·
You're already dead...
Joined
·
10,293 Posts
s.t.a.r.s.:

can't you just post the source-code? xD

but yeah... can't wait for the video :D
 

·
Registered
Joined
·
598 Posts
Discussion Starter · #12 ·
Hehe lol nice try xD
Well the video isn't anything special lol.I just showed the main way of how I usually do that.Lol I bet that nobody is not saving changes on the way like I do xD xD xD:dead:
The uploading is at 63%...so slow:dead:
 

·
No sir, I don't like it.
Joined
·
7,022 Posts
Hehe anyone recognizes the picture bellow?:D
Memories of college and screwing around with XP come flooding back to me.

EDIT: 89.3MBs? I really need to make a thread explaining how to create optimized video encodes.

EDIT2: You're a really slow typer, S.T.A.R.S. :p Would've been better to just use record your own voice as you go along.

EDIT3: Ctrl-A is the keyboard shortcut for 'select all'.
 

·
Registered
Joined
·
598 Posts
Discussion Starter · #15 ·
Memories of college and screwing around with XP come flooding back to me.

EDIT: 89.3MBs? I really need to make a thread explaining how to create optimized video encodes.

EDIT2: You're a really slow typer, S.T.A.R.S. :p Would've been better to just use record your own voice as you go along.

EDIT3: Ctrl-A is the keyboard shortcut for 'select all'.
Lol if I was talking,you wouldn't understand a word xD I am a slow typer,but fast in talking xD

So was the video good except of my typing and the video file size?:D
 

·
No sir, I don't like it.
Joined
·
7,022 Posts
A lot better than previous videos. :rolleyes:

Though the use of text typing instead of a voice-over makes it boring to watch. I would say add some music, but your tastes in music may differ radically with someone else's causing them to mute the video or stop watching it completely. I fired up Winamp and started playing from a good playlist so I could watch it through.
 

·
You're already dead...
Joined
·
10,293 Posts
stars:

dude you could have just posted the source-code instead of a 45 minute video :D

but i actually learned something from that video.
msvc#'s form builder is very-very similar to VB.net. it also handles events like VB.
i just wish it supported macros and templates (especially macros, they're terribly useful).

anyways stars,
while that method does work, it is horribly inefficient and could get very messy if you have a lot of options.
 

·
Emu Author
Joined
·
616 Posts
c# i believe does have some form of templates or something extremely close to it. i am unsure of macros and for me macros are not really needed since they are just about like functions in a way and i never used macros in any c/c++ code i ever wrote though i do know what they are and how to use them if i did need them(i got that from reading a nice and very detailed book on stuff like that before, nice reading). but yea c# is nice when given a chance to be worked with well. i never got to far into learning vb, the book i used to learn it turned me away since when i tried to make a notepad like app going by the instructions by the letter, it did not work at all like the book claimed which turned me away to another language which ironically i think was c/c++ lol.
 

·
You're already dead...
Joined
·
10,293 Posts
c# has generics, but they're more limited than templates. you can't do "template metaprogramming" for example.
C# Frequently Asked Questions : How do C# generics compare to C++ templates?
Template metaprogramming - Wikipedia, the free encyclopedia

and functions aren't as nice as macros for some situations, and not everything a macro does can be done by functions.
also, even if you can do the job with a function, many times it will be less optimized since macros are compile-time generated code.

one time i used macros to generate some opcode tables that pointed to template-functions which needed multiple instances.
i reduced the tables from ~1000 lines to ~260 lines using macros.

Diff of microVU_Tables.inl r1166 - pcsx2 - Google Code

this would not have been possible using functions.
in fact, ~90% of the times i use macros, it can't be done with a function.

what if you have some really nested struct var that you use frequently like:
house.door.knob.keyhole = 1;
you can just do:
#define hKeyhole house.door.knob.keyhole
and use 'hKeyhole' instead, like:
hKeyhole = 1;

i also do stuff like that a lot too, although some people don't like it because its harder to understand the code at first glance.

there's a lot of other useful things macros are good for (too much to go into detail here). they're one big reason i like c++ so much.
before i learned the language, i didn't know there was something so powerful.
and i still didn't understand how powerful they could be till i looked at some of the different ways people used them xD
 

·
Emu Author
Joined
·
616 Posts
like i said i understand the usefulness of macros, i read a giant amount of info on them and i know c# has nothing as powerful as macros, i never intended to bash them in anyway :D.

as i told @ruantec earlier, i like using c# right now for the emus i am doing but if a time comes that i feel c# just wont do the job the way i need, i will attempt to modify and pull in as much c++ code to use in my c# code as i can but if i really need to i will without a doubt switch back to c++, both languages(well all 3 if you do not count c and c++ as about the same in a sense) are great languages, both have pros and cons. but i will use c++ where i need it without hesitation as i do realize how nice c/c++ can be as i started out on c/c++ and it can be nice, my only main issue is that working with window creation and directx is a royal pain and is one reason why i switched to c# when i started learning it.

i do know c++ macros can selectively do a lot of things just like normal functions can and at the same time cut down on a lot of code as well where as to achieve the same functionality just is not as readily possible with standard functions which is what makes macros so powerful but yes they can cause other issues in terms of readability too. but i suppose thats why you should use proper naming and comments for those cases too i guess.
 
1 - 20 of 38 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top