|
|
Search
|
|||||||
| Home | Register | Downloads | FAQ | Members List | Calendar | Arcade | Mark Forums Read |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
![]() ![]() ![]() ![]() Join Date: Jan 2006
Location: Planet Earth...
Posts: 593
|
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 ![]() 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...
__________________
|
|
|
|
| Advertisement | [Remove Advertisement] | ||
|
|
|
|
#3 (permalink) | |
|
You're already dead...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Post-Apocalyptic Earth
Posts: 3,900
|
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
__________________
Quote:
check out my blog ![]() |
|
|
|
|
|
|
#5 (permalink) |
|
Emu Author
![]() ![]() ![]() Join Date: Dec 2004
Location: North Carolina
Posts: 373
|
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. |
|
|
|
|
|
#6 (permalink) |
|
Emu author
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2002
Location: Austria (originally from Dominican Republic)
Posts: 2,378
|
XML can be a good way to that.. there´s a class for it.
__________________
Current development tools: Visual C++.net, Visual C#.net Visual VB.net, Visual Webdeveloper.net Bloodshed Dev C++, Borland C++ Visual Basic 6 |
|
|
|
|
|
#7 (permalink) |
![]() ![]() ![]() ![]() Join Date: Jan 2006
Location: Planet Earth...
Posts: 593
|
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. ![]() 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?
__________________
|
|
|
|
|
|
#8 (permalink) | ||
|
You're already dead...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Post-Apocalyptic Earth
Posts: 3,900
|
Quote:
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
__________________
Quote:
check out my blog ![]() |
||
|
|
|
|
|
#9 (permalink) | |
![]() ![]() ![]() ![]() Join Date: Jan 2006
Location: Planet Earth...
Posts: 593
|
Quote:
__________________
|
|
|
|
|
|
|
#10 (permalink) | |
|
No sir. I don't like it.
![]() ![]() ![]() ![]() ![]() Join Date: Oct 2008
Location: Alabama
Posts: 2,455
|
Can't wait...
__________________
Quote:
Phenom II X4 @ 3.6GHz | 4GB OCZ Dominator DDR3 @ 1600MHz Sapphire Vapor-X Radeon HD4850 | Samsung TOC 24" 1920x1200 Auzentech X-Fi Forte 7.1 | Klipsch Promedia 5.1 THX LG H20L BD-RE | WD Caviar Black 1TB 7200RPM GIGABYTE GA-MA790FXT-UD5P | Windows 7 x64 Ultimate Join the NGEmu Folding@Home Team! Info Download the standard client here OR preferably download the GPU or SMP client here. Set your team ID to: 161326 NGEmu Stats Page: Here |
|
|
|
|
|
|
#11 (permalink) | |
|
You're already dead...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Post-Apocalyptic Earth
Posts: 3,900
|
s.t.a.r.s.: can't you just post the source-code? xD but yeah... can't wait for the video
__________________
Quote:
check out my blog ![]() |
|
|
|
|
|
|
#12 (permalink) |
![]() ![]() ![]() ![]() Join Date: Jan 2006
Location: Planet Earth...
Posts: 593
|
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 ![]() The uploading is at 63%...so slow
__________________
|
|
|
|
|
|
#13 (permalink) |
![]() ![]() ![]() ![]() Join Date: Jan 2006
Location: Planet Earth...
Posts: 593
|
Hehe anyone recognizes the picture bellow? ![]() Ohh btw the uploading is finished.To download the video,click the link bellow: Send big files the easy way. Files too large for email attachments? No problem! Please comment the video xD
__________________
|
|
|
|
|
|
#14 (permalink) | |
|
No sir. I don't like it.
![]() ![]() ![]() ![]() ![]() Join Date: Oct 2008
Location: Alabama
Posts: 2,455
|
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. 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'.
__________________
Quote:
Phenom II X4 @ 3.6GHz | 4GB OCZ Dominator DDR3 @ 1600MHz Sapphire Vapor-X Radeon HD4850 | Samsung TOC 24" 1920x1200 Auzentech X-Fi Forte 7.1 | Klipsch Promedia 5.1 THX LG H20L BD-RE | WD Caviar Black 1TB 7200RPM GIGABYTE GA-MA790FXT-UD5P | Windows 7 x64 Ultimate Join the NGEmu Folding@Home Team! Info Download the standard client here OR preferably download the GPU or SMP client here. Set your team ID to: 161326 NGEmu Stats Page: Here Last edited by masta.g.86; June 9th, 2009 at 03:40.. |
|
|
|
|
|
|
#15 (permalink) | |
![]() ![]() ![]() ![]() Join Date: Jan 2006
Location: Planet Earth...
Posts: 593
|
Quote:
So was the video good except of my typing and the video file size?
__________________
|
|
|
|
|
|
|
#16 (permalink) | |
|
No sir. I don't like it.
![]() ![]() ![]() ![]() ![]() Join Date: Oct 2008
Location: Alabama
Posts: 2,455
|
A lot better than previous videos. ![]() 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.
__________________
Quote:
Phenom II X4 @ 3.6GHz | 4GB OCZ Dominator DDR3 @ 1600MHz Sapphire Vapor-X Radeon HD4850 | Samsung TOC 24" 1920x1200 Auzentech X-Fi Forte 7.1 | Klipsch Promedia 5.1 THX LG H20L BD-RE | WD Caviar Black 1TB 7200RPM GIGABYTE GA-MA790FXT-UD5P | Windows 7 x64 Ultimate Join the NGEmu Folding@Home Team! Info Download the standard client here OR preferably download the GPU or SMP client here. Set your team ID to: 161326 NGEmu Stats Page: Here |
|
|
|
|
|
|
#17 (permalink) | |
|
You're already dead...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Post-Apocalyptic Earth
Posts: 3,900
|
stars: dude you could have just posted the source-code instead of a 45 minute video ![]() 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.
__________________
Quote:
check out my blog ![]() |
|
|
|
|
|
|
#18 (permalink) |
|
Emu Author
![]() ![]() ![]() Join Date: Dec 2004
Location: North Carolina
Posts: 373
|
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.
|
|
|
|
|
|
#19 (permalink) | |
|
You're already dead...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Post-Apocalyptic Earth
Posts: 3,900
|
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
__________________
Quote:
check out my blog ![]() |
|
|
|
|
|
|
#20 (permalink) |
|
Emu Author
![]() ![]() ![]() Join Date: Dec 2004
Location: North Carolina
Posts: 373
|
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 .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. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|