|
window application, and as i already told, it's a English dictionary
one word for each line
|
|
|
|
|
One simple way to protect your data is to
hard code it by making some class (and taking generic
list).
Second way is store it in settings file.
Third way is store it in xml file and encrypt it.
Hope this will help!
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Then store the text in your applications resources, or you could encrypt the text file and store it with a different extension, or ...
|
|
|
|
|
Dave Kreskowiak wrote: Then store the text in your applications resources
happy to learn that...
could you explain more please ?
|
|
|
|
|
You could always write the data out as a binary formatted file. Here's an example using the BinaryFormatter :
using (FileStream stream = new FileStream(WordFilePath, FileMode.OpenOrCreate))
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(stream, _words);
stream.Close();
}
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I would store them in a database, but that's just me.
|
|
|
|
|
pls which starts the execution of a C # application?
thanks.
|
|
|
|
|
what do you want to ask, please explain in detail.
|
|
|
|
|
Execution of C# application starts from method Main().
|
|
|
|
|
|
Hey guys,
I have a question regarding the components which have a built in datasourse, like datagrid, combo box, ...
I dunno whether my windows application I'm working on, is gonna be run on a single computer or on a server and in a network, so how should I define the connection string, clearly I cannot go for code-less method (am I right ? ), so how should I tackle this problem ?
this is basically my general question for my whole application as well and Would be greatful if u helped me out!
regrads,
K
|
|
|
|
|
Never hard-code connection strings - put them in the application config file. That way the DB can move without code changes.
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
I'm aware of that, and thats what I'm doing but still the servername differs from one computer to another, well one solution I thought of was to install their SQL server manually set the server name to a specific name which is in my application ... but I wanted to see if there were other possible ways !
regards
|
|
|
|
|
Include the servername in the connection string - it is part of it. Then configure SQL server as part of the install procedure (do a test connect and if it fails get them to enter it manually) then save it in the app.config file.
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
I prefer to have a system-wide, non-application-specific configuration file that lists the databases available to the system.
Such a file can be stored in the Application Data directory for the user or all users -- so all users can have the same settings, or each user can have his own.
And I don't store actual connection strings; I store the information required to cobble one up for the requested database engine.
Here's an older version:
<DATABASES>
<CT TYPE="SQLSERVER" SERVER="LOCALHOST\SQLEXPRESS" NAME="CoconutTelegraph" />
<DTER TYPE="SQLSERVER" SERVER="LOCALHOST\SQLEXPRESS" NAME="DTER" />
<DDLTEST TYPE="SQLSERVER" SERVER="LOCALHOST\SQLEXPRESS" NAME="DDLTEST" />
<FIREBIRD TYPE="FIREBIRD" SERVER="LOCALHOST" NAME="C:\Program Files\Firebird\examples\empbuild\employee.fdb" USERNAME="SYSDBA" PASSWORD="masterkey" />
<MPG TYPE="SQLSERVER" SERVER="LOCALHOST\SQLEXPRESS" NAME="MPG" />
<MR TYPE="SQLSERVER" SERVER="LOCALHOST\SQLEXPRESS" NAME="MusicLibrary" />
<RUBBISH TYPE="SQLSERVER" SERVER="LOCALHOST\SQLEXPRESS" NAME="Rubbish" />
<SA TYPE="SQLSERVER" SERVER="LOCALHOST\SQLEXPRESS" NAME="VersionControl" />
<WORDSEARCH TYPE="ACCESS" NAME="C:\projects\wordsearch\bin\release\WordSearch.MDB" PASSWORD=":badger:" USERNAME="admin" USERPASSWORD="" />
</DATABASES>
And here's a version I'm working with this week:
<Databases>
<Junk Provider="SqlServer" Parameters=".\SQLEXPRESS,Junk" />
</Databases>
This allows the application to be more database agnostic -- it doesn't need to know which database engine is in use.
|
|
|
|
|
thanx for the response but I'm afraid I didn't get it exactly, could u elaborate more on how to use this piece of code and where to use it ?
thanx alot!
|
|
|
|
|
After read the Essential C#, I am still puzzled why C# has the event keyword.
The Delegate is similiar with the function pointer in C/C++ and can make the function of programming needed. So I think that the event is unwanted.
right?
modified on Wednesday, July 7, 2010 11:33 AM
|
|
|
|
|
yu-jian wrote: So I think that the event is unwanted.
right?
Wrong. Sorry, but event is a specialist form of multicast delegate - to achieve this specialism, the event keyword was necessary.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
You're wrong, and that's probably why you're not working on the C# team at Microsoft.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Yes, but... the event keyword allows special handling of the multicast delegate:
0) Only the defining class can raise/call/execute the event.
1) All other classes are required to use the += and -= operators.
You are welcome to use non-event multicast delegates in your code if you like. Come back and let us know how it goes.
|
|
|
|
|
Your answer is good. I know event is useful,
Thanks very much.
|
|
|
|
|
I am working with .net application. I have few informations in string. Now i would like to put this string into html tags. Lets say i have array of names and i would like to write them down in html paragraph. How could i do this in c# code?
|
|
|
|
|
You can use response.write() function to do that.
string htmltodisp="here is my string to display in paragraph";
Response.Write("<p>" + htmltodisp + "</p>");
Hope this will help!
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
It depends how you want to format the data. Suppose for instance that you want each name in a paragraph, a quick and dirty hack to do this would be to use something like:
StringBuilder sb = new StringBuilder();
foreach(string name in names)
{
sb.AppendFormat("<p>{0}</p>", name);
} Alternatively you could look at the HtmlTextWriter[^] class to do the job properly.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Pete O'Hanlon wrote: Alternatively you could look at the HtmlTextWriter[^] class to do the job properly.
I think he's better off writing it the frist way. What benefit does the HtmlTextWriter have? I diodn't see any, myself.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|