|
sharpiesharpie wrote: when a reminder is added it's saved to the xml file and then the list loads it
Change the order of events. Whenever a reminder is added, it gets stored in the list and afterwards the list is saved (maybe only once when the application shuts down). Deserialization happens only once when you start your application.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
err..yeah..i was afraid i was gonna have to do that.
btw, why would it matter if the variables in the Reminder class are public or not?
|
|
|
|
|
The point is that making fields accessible through properties is much better than simply declaring them public. Some citations from MSDN:
Properties are members that provide a flexible mechanism to read, write, or compute the values of private fields. Properties can be used as though they are public data members, but they are actually special methods called accessors. This enables data to be accessed easily while still providing the safety and flexibility of methods.
Properties have many uses: they can validate data before allowing a change; they can transparently expose data on a class where that data is actually retrieved from some other source, such as a database; they can take an action when data is changed, such as raising an event, or changing the value of other fields; they can be read-only.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
jeez, i hate being such a pain in the..you know...but now i have another unexplainable problem, this is my saving function:
string s_FileName = Application.StartupPath + "\\List.xml";
FileStream fs = new FileStream(s_FileName, FileMode.Create, FileAccess.Write);
ArrayList al = new ArrayList();
foreach (ListViewItem i in listView1.Items)
{
Reminder r = new Reminder();
r.Name = i.Text;
r.Date = i.SubItems[1].Text;
r.Time = i.SubItems[2].Text;
r.Comment = i.SubItems[3].Text;
al.Add(r);
}
XmlSerializer xs = new XmlSerializer(typeof(ArrayList));
xs.Serialize(fs, al);
when i run it i get a System.InvalidOperationException (the error is on the xs.Seialize line).
why? =\
|
|
|
|
|
Never mind, after going through like 15 pages in google i managed to find a page which said you can't serialize an arraylist, so i converted it to an array of Reminders and it worked.
|
|
|
|
|
Hi all,
I need to make code on button which enables us to change languages of controls in the form
|
|
|
|
|
Set the forms Localizable property to true.
Create a resource file for each language. E.g. Form1.en-GB.resx, Form1.fr-CA.resx. (The existing Form1.resx is the neutral culture resource files)
Use a ComponentResouceManager object to apply the appropriate resources to each control on the form when the button is pressed.
Simon
|
|
|
|
|
Thanx alot for ur reply but now i'm in a new problem
i've created resource files for each language but i'm not able to apply a resourse file from them to the form when pressing on button
|
|
|
|
|
I've written a component that should help you to achieve this. Take a look at its article: UICultureChanger component[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
hi, every one.
I was trying to change an object value of a listbox, I've tried these lines of codes:
listbox1.Text = "hello";
listbox1.SelectedItem = "hello";
but this didn't change the content of the object selected in the listbox, although
that in MSDN they mentioned that these properties have both set and get assessors.
I come up with a solution, remove the object at a specific index using RemovAt(), and
then inserting a new object at the same index using Insert().
but I do want to know if there is any direct way(function, property) to change an object
in listbox.
|
|
|
|
|
Hi, you can do things such as:
lb.Items[2]="new text for line 2";
lb.Items[lb.SelectedIndex]="new text for the selected line";
Luc Pattyn
|
|
|
|
|
thanks
|
|
|
|
|
i have a problem to draw the graphic line
i want to draw a line that the middle of this line have text ( that enter from user )
is there any code that can help me ?
With thanks
MHF
|
|
|
|
|
Use the Graphics.MeasureString method to get the width of the text when drawn with a specific font. Use this value to calculate the starting point passed to the Graphics.DrawString method, so that the text will be drawn in the middle of your line.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Dear all,
I have the following question, and I would highly appreciate it if anyone of you could point e in the right direction. I have this DataGridView, which is filled somewhere along the line. I want to export the values of each individual column and row to a global integer in order to use this value a bit further up in my application. I dreamed up something like this :
public static string NAME;
And inside the methode :
NAME = dataGridView2.Rows[dataGridView2.CurrentCell.RowIndex].Cells["werkAantalDataGridViewTextBoxColumn"].Value.ToString();
or if I want to dump the value to a textbox :
this.txt1.Text = dataGridView2.Rows[dataGridView2.CurrentCell.RowIndex].Cells["werkAantalDataGridViewTextBoxColumn"].Value.ToString();
This works, until I have multiple values in my columns. I would like to display all of the values in the column or row. How can I tell the program to move to the next column or row, grab the value and store it somewhere.
Any help would be kindly appreciated.
Cheers
|
|
|
|
|
There are many ways this can be accomplished, all depending on what classes you're using. Typically it's better to enumerate the backend data store, instead of its graphical representation. If you bound your DataGridView to a DataSet , for example, there are quite a few ways - including using basic SQL syntax with some amount of aggregation support that might help you with, say, a numerical sum - to enumerate rows and columns. I would recommend that approach. You can even generically enumerate the backend data store - be it a DataSet or even an object array of some type - by using a currency manager. Below is one example that depends on binding to a DataSet . You could use a PropertyManager for objects in an array in very much the same way. The could could be branched to support both.
CurrencyManager cm = (CurrencyManager)dataGridView1.BindingContext[dataGridView1.DataSource, dataGridView1.DataMember];
StringBuilder sb = new StringBuilder();
foreach (DataRowView rowView in (DataView)cm.List)
{
sb.Append(rowView["werkAantalDataGridViewTextBoxColumn"].ToString());
sb.Append(", ");
}
string aggregate = sb.ToString(); I encourage you to explore the member documentation for the DataGridView for more ways to enumerate the data store, both by using the DataGridView class members and getting the underlying data store to enumerate.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello Guys,
how can we build a virtual machine to convert cobol code to dot net.???
once the migration is complete the dot net code should perform all the business functionality currently done by the cobol code.or is there any way i can compile it to .DLL so that i can use in my .NET code???
Or any good suggetions for that....
Please...share
Regards ,
nishu
|
|
|
|
|
You would not create a virtual machine, which houses OSs, to convert COBOL code to .NET. You would have to write you own program, if one does not already exist, that will convert COBOL code to .NET.
As for having a COBOL dll, I have no idea. If the dll produced is a standard windows dll then you should be able to use DllImport to extract specific methods and use them in your .NET applications. You may even consider a dll wrapper, if that would be better suited.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Have you looked at Fujitsu Cobol.NET?
|
|
|
|
|
Thanks guys...
Ya i visited that one..
nishu
|
|
|
|
|
Hi everyone,
I'm using a TextBox as an activity log for some worker threads. I'd like to automatically scroll down to the end whenever I append text to the TextBox.
Anyone know how to do this? Looking at the documentation, I can't even figure how to get a handle on the scrollbar.
|
|
|
|
|
Try the ScrollToCaret method.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks, ScrollToCaret is what I was looking for.
|
|
|
|
|
I use TopIndex
for an example, have a look at method log() in file MainForm.cs of my Skoban article[^]
Luc Pattyn
|
|
|
|
|
Hi !
i m using opensmtp DLL and by using its class MailMessage i m sending the email.But its method CC takes array list ....but i m unbale to use it.
|
|
|
|