|
|
The standard methodology for application settings since .Net 2.0 is pretty good. There are several good articles on their use here on CP, search on 'User Settings' or 'Application Settings'. Also check out the MSDN entries on the same topics, V.G.
However, I have little experience with Windows services, and am not aware of how they interact with either datasets or application settings files.
Whatever approach you take remember that a dataset is an in-memory representation of data, which can incidentally be read from a database or an XML file (Application Settings == *.config == XML). I would have thought that keeping the memory footprint down would be a good idea for a Windows Service.
Sorry I cannot be of more help, but hope this gives you some ideas.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thank you both for your responses. The resources and general information you gave will keep me busy and are a great starting point. Thanks so much!
|
|
|
|
|
|
I dont understand what exactly you're trying to do but it little bit seems to be as I've done this earlier. It would be best if you show a picture of what you want.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">myventsi wrote:</div>create a table </blockquote>
The first thing to do is to open a connection to the database.
Using that connection, you create your table. See http://www.w3schools.com/sql/sql_create_table.asp[^] for how to do that using SQL.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
hi im doing a small project for friend.. i need to get the data out of xml so that i can verify the username and password
xml is like this
PLEASE HELP THE ERROR I GET IS EXPLAINED IN THE MIDDLE.. THANKS ALOTTTT
<clientlogind>
<client username="faizych">
Password="pass"
/>
<client username="taha89">
Password="pass78"
/>
and to get the value im doing
private void button1_Click(object sender, EventArgs e)
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load("path.xml");
System.Xml.XmlNodeList client;
XmlNode clientNode = xmldoc.DocumentElement;
client = clientNode.SelectNodes("Client");
string Usernamttext = txtUsername.Text;
string passwordtext = txtpassword.Text;
foreach (XmlNode DataNode in client)
{
string userid;
string password;
************************************************************************************************
******* ERROR HERE*** now when i run it it gives me an error when it gets to the line below that """object reference not set to an instance of an object"""
*************************************************************************************************
userid = DataNode.SelectSingleNode("Username").InnerText.Trim();
password = DataNode.SelectSingleNode("password").InnerText.Trim();
if (string.Compare(Usernamttext, userid) == 0)
{
if (string.Compare(passwordtext, password) == 0)
{
break;
UserProfile UserProfileForm = new UserProfile();
UserProfileForm.usernamevalue = userid;
UserProfileForm.Show();
this.Close();
}
else
{
MessageBox.Show("Invalid Username or password");
}
}
}
}
|
|
|
|
|
No pre tags, no formatting all equal to fail.
|
|
|
|
|
It's hard to tell without the code formatted properly. Because HTML uses <> and </>tags like XML, some of your code is also being swallowed!
A quick look at the source and it maybe that in the XML you're using username and in your code you're using Username
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
DaveyM69 wrote: in the XML you're using username and in your code you're using Username
Or in the XML he is using Password, but in the code he's using password.
This might have been useful if I'd replied to the OP, instead of you.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
this is right way
XmlNode xmlNode;
if ((xmlNode = DataNode.SelectSingleNode("Username")) != null)
userid = xmlNode.InnerText.Trim();
else
{
MessageBox.Show("User name didn't found", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi,
I have been searching around for a single elimination algorithm / pseudo code for tournament brackets and I haven't found a single site on it. The best I found was Wikipedia explaining single elimination. I have been reading code project articles for a while now and I know there are many experience and very knowledgeable developers here. Since this is fairly simple to code I was hoping if somebody could help me out with the code/pseudo code or an algorithm for it. I would appreciate it a lot. Looking forward to your replies.
|
|
|
|
|
After hours of trying to get it to work I finally got it working. If there is anybody that needs help on this and stumble across this let me know and I can help you out...
|
|
|
|
|
Did you post information on Tournaments anywhere?? I'd be interested to see what you did on this.
Thanks..
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
Hi Guys,
How can I implement a separator in ComboBox, such that objects of two different classes can be easily distinguised. Does it require any coding or just simple designing tactics? Please Help.....
Your help will be appreciated.....
Rajdeep.NET!
modified on Thursday, April 2, 2009 3:42 PM
|
|
|
|
|
AFAIK you can't without quite a bit of work.
You'd need to set the DrawMode to one of the OwnerDrawn modes, and handle the DrawItem event yourself to detect whatever you use as a separator and draw what you require. Making it non selectable is going to be another challenge!
I know you're a beginner in C#, this may be a little adventurous IMO until you've got to grips fully with the fundementals.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Oh my! There seems to be huge task to be accomplished . I think I have to learn how to draw graphics on Windows Forms in order to achieve this. Anyways, thanx Davey. u r very helpful!
|
|
|
|
|
I am a little confused by this.. I get it to draw the lines on the panel, but when I try to save it to a file it is blank?
Here is my panels MouseMove:
private void panelSig_MouseMove(object sender, MouseEventArgs e)
{
if (shouldPaint)
{
Graphics graphic = panelSig.CreateGraphics();
Cursor.Clip = new Rectangle(this.PointToScreen(panelSig.Location), panelSig.Size);
graphic.DrawLine(pen, lastPoint.X, lastPoint.Y, e.X, e.Y);
graphic.Dispose();
lastPoint.X = e.X;
lastPoint.Y = e.Y;
panelSig.Invalidate(new Rectangle(0, 0, panelSig.Width, panelSig.Height));
Cursor.Clip = new Rectangle(0, 0, 0, 0);
}
}
Here is the MouseDown and MouseUp:
private void panelSig_MouseDown(object sender, MouseEventArgs e)
{
shouldPaint = true;
lastPoint.X = e.X;
lastPoint.Y = e.Y;
}
private void panelSig_MouseUp(object sender, MouseEventArgs e)
{
shouldPaint = false;
}
But when I try to save it to a file it doesnt work?? I'm confused... I realy want to save it in a SQL database, but I figured I should get it to save to a file first to see.. It saves.... just the panel, not the actual lines I drew.
Here is how I am saving it:
Bitmap TestBMP = new Bitmap(panelSig.Width, panelSig.Height);
FileStream fs = new FileStream(saveFile.FileName, FileMode.Create, FileAccess.Write);
panelSig.DrawToBitmap(TestBMP, new Rectangle(0, 0, panelSig.Width, panelSig.Height));
TestBMP.Save(fs, ImageFormat.Png);
fs.Close();
|
|
|
|
|
You will also find that if you drag your window off the side of the screen then drag it back on again you will have lost the lines you have drawn too.
This is because what you draw is not stored anywhere. It is simply drawn on the surface. If the panel is invalidated the OnPaint method is called and it is redrawn, losing what ever you drew on it.
If you need to store the information you need to draw to a bitmap, then draw the bitmap onto the panel. When you come to save the information to a file (or database) you have the bitmap already.
And, by the way, your panel will have to re-draw the bitmap in the OnPaint method.
|
|
|
|
|
Well what is being drew on the panel is a signature.
So I still need each line put... how exactly would I save that to a bitmap or just do it with the OnPaint method.
|
|
|
|
|
You draw on the bitmap instead of the panel. Once it is on the bitmap you draw the bitmap to the panel.
The OnPaint method is called with the panel is invalidated or otherwise needs to be repainted. This is why you need to draw the bitmap in the OnPaint.
And one thing I didn't explain before is that you probably want to create your own class derived from Panel so that you can override the OnPaint method (otherwise you will be creating an OnPaint method in the wrong place)
If you are using these functions I would also recommend Charles Petzold's book on programming Windows with .NET.
|
|
|
|
|
Well I have a bunch of books at home... I just always skipped over the graphics part of it lol. I will go back and read those now that I see where I would use them... I got it to work.. this is what I did:
private Bitmap bmp;
MouseMove:
private void panelSig_MouseMove(object sender, MouseEventArgs e)
{
if (shouldPaint)
{
Graphics graphic = Graphics.FromImage(bmp);
Cursor.Clip = new Rectangle(this.PointToScreen(panelSig.Location), panelSig.Size);
graphic.DrawLine(pen, lastPoint.X, lastPoint.Y, e.X, e.Y);
graphic.Dispose();
lastPoint.X = e.X;
lastPoint.Y = e.Y;
panelSig.Invalidate();
Cursor.Clip = new Rectangle(0, 0, 0, 0);
}
}
OnPaint (draw the BMP on the panel)
private void panelSig_Paint(object sender, PaintEventArgs e)
{
Graphics graphic = e.Graphics;
graphic.DrawImage(bmp, 0, 0, bmp.Width, bmp.Height);
}
private void panelSig_MouseDown(object sender, MouseEventArgs e)
{
shouldPaint = true;
lastPoint.X = e.X;
lastPoint.Y = e.Y;
}
private void panelSig_MouseUp(object sender, MouseEventArgs e)
{
shouldPaint = false;
}
Seems to work great so far...
|
|
|
|
|
I want to bind an in-memory data class to a DataGridView using the DataSource member. I have read several ways of doing this and have implemented and tried several but once I set the DataSource, I then lose the ability to sort.
I want to display my data class inside of a grid. I can use a List (List < MyDataClass >, for example) which works but I lose sorting. I can get sorting back, but I have to create my row like this
<br />
object[] row = {MyDataClass.FirstName, MyDataClass.LastName};<br />
which then removes the binding to the actual objects.
I've now been trying to use DataSets and DataTables, but I still lose my binding. And the columns are not automatically generated from the exposed properties, like when I use a List collection.
My next step is to create a class implementing the IBindingList interface. Will this be what I want? Any help or advice is greatly appreciated. Thanks.
Oh, another wrench in the idea is that I want to flatten out the object. So my object may contain other objects which I want to also display in the table as part of the same row. I was thinking there was a way to bind a specific grid column to an object's property, but I haven't been able to find that yet.
|
|
|
|