|
If you are using framework 2, use a SortedList instead of ArrayList, or a List and use it's Sort method.
Otherwise, you can use the Sort method of the ArrayList.
---
Year happy = new Year(2007);
|
|
|
|
|
THank u so much. I applied it like,
ICollection userDetails = new SortedList();
But the contents are not sorted. Can u pls. suggest me what was the problem.
Regards,
Prya
|
|
|
|
|
The problem is that you are not using the list that you create in that line. The GetAllUsers method returns a new list and the first list is thrown away.
---
Year happy = new Year(2007);
|
|
|
|
|
Hi all,
I have a question that isn't possible store value/data in application instead of in database. What i mean here is even i close my application,those value which are stored/saved is still remain in my application.When next time i run again that application,the value still be the same as before.I know some functions like setting.save() ,but dun know is correct or not.
Can someone give me a hand or guide me to solve it out?any hits are welcome.
thanks in advance.
cocoonwls
|
|
|
|
|
You can use xml file instead of database or also
You can save into the windows registry.
Keep Smiling !!!
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Are you using .NET 2.0 ? In 2.0, there's a properties section that handles saving and loading app data for you.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
hi Christian Graus,
Yes,i am using .NET 2.0. Can you please give me an simple example or related information link?
Thanks,;)
cocoonwls
|
|
|
|
|
Your app has a properties section, in this you can add a property name and value. I believe that Application.Properties.PropName is how you access them.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
hi,
I found it1 But i have one more question,what is the different between user scope and application scope.Thanks alot!
|
|
|
|
|
The values get stored in my documents. Use scope means each user has their own config. Application scope means the app has values the same for all users.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Further to this.
If you are using C#, expand Properties in Solution Explorer and open Settings.settings. Add your settings here. Access your settings in-code with:
something = Properties.Settings.Default.MySetting
or
something = Properties.Settings.Default["MySetting"];
if you have edited User settings during runtime and wish to save them, call:
Properties.Settings.Default.Save();
User settings:
*Can be changed and saved during runtime.
*Get stored in ...\Documents and Settings\Application Data\<appname>
Application settings:
*Cannot be edited during runtime.
*Get stored in the application folder.
-- modified at 4:30 Tuesday 23rd January, 2007
|
|
|
|
|
Personally I try to keep all needed data in a serializable object.
Then before closing i serialize the object into a string, and store the string in a registry key.
At Loading Registry Key existance an value validity is checked.If that goes ok, deserialization occurs and everything is fine.
To accomplish that i have created some objects with static functions to use in every application.
|
|
|
|
|
Hi All,
I am working with Windows Forms using C#, i have a treeview populated with nodes, child nodes and further subnodes, I need to create a BACK button using which i need to track back the previous node selections on treeview just similar to BACK button on IE.
I appreciate any kind of help through code sample.
Thank you
|
|
|
|
|
You can try it, when click on back button.........
If Not (TreeView.SelectedNode.PrevVisibleNode Is Nothing) Then
TreeView.SelectedNode = TreeView.SelectedNode.PrevVisibleNode
TreeView.Focus()
End If
It helpful for u...................
Keep Smiling !!!
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Do something like this:
1) Make sure you are using System.Collections;
2) Declare ArrayList history; in your Form derived class (let it be Form1 ), and treeView1 your TrieView control;
3) Initialize history in Form1_Load(object sender, EventArgs e) :
history = new ArrayList();
4) In the private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) handler, write this piece of code:
TreeNode tn = treeView1.SelectedNode;<br />
if (tn != null) history.Add(tn);
5) In the private void YourGoBackButton_Click(object sender, EventArgs e) , write this piece of code:
if (history.Count < 2) return;<br />
treeView1.AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(treeView1_AfterSelect);<br />
TreeNode tn = (TreeNode)history[history.Count - 2];<br />
history.RemoveAt(history.Count - 1);<br />
treeView1.SelectedNode = tn;<br />
while (tn != null)<br />
{<br />
tn.Expand();<br />
tn = tn.Parent;<br />
}<br />
treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(treeView1_AfterSelect);<br />
treeView1.Focus();<br />
Enjoy!
SkyWalker
|
|
|
|
|
It might be simpler to use Stack<T>:
Stack<TreeNode> history = new Stack<TreeNode>();
bool cancelPush = false;
private void button1_Click(object sender, EventArgs e)
{
if (history.Count > 0)
{
cancelPush = true;
treeView1.SelectedNode = history.Pop();
treeView1.Focus();
}
}
private void treeView1_BeforeSelect(object sender, TreeViewCancelEventArgs e)
{
if (!cancelPush)
{
history.Push(treeView1.SelectedNode);
}
else
{
cancelPush = false;
}
}
|
|
|
|
|
i have got another problem
i have got a insert statement using which i update my database in the local system it is happening good in the local system...
now coming to application which is put on the webserver now my database is not updating properly i am getting an exception.
i am using server.mappath("dls.mdb");
dls.mdb is my databse name and server.mappath is returning exactly the path on the remote system (like d:/mywebsite/dls.mdb).
please solve me and let me knwo
|
|
|
|
|
Define "not updating properly" Do you get an error ? Can you select data from this db ? Is the file read only ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
the exception which i get is
System.Data.OleDb.OleDbException: Operation must use an updateable query. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at Details.btnsubmit_Click(Object sender, EventArgs e)
in the webserver
and the file is not read only
|
|
|
|
|
A great way to solve error issues is to google the error message. I found this:
http://support.microsoft.com/default.aspx/kb/830977[^]
In a nutshell:
This problem occurs when a Microsoft Access database file is used as your database source because you must grant write access to both the default worker process identity and the authenticated user.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thanks a lot dude
i fighting from yesterday
thanks a lot
bye
|
|
|
|
|
our website is being hosted by some other people sir
and now i have changed write permission and i updated on the webserver
still the same problem is coming
do i need to publish my site once again and update all of them or
only the databasse file has to replaced sir
thanking u bye
|
|
|
|
|
Hi to everyone!
I need to get the autonumeric field assigned to a new record, because I want to use it on a different table.
ExecuteNonQuery retrieves the number of affected rows. But how can I get a dataset result of the affected rows, as the one using an ExecuteQuery command?
Thanks for everyones time!
daniel sovino
|
|
|
|
|
You can ask he database for the last created key. Depending on what database you are using, you use different functions:
MySQL: select last_insert_id()
MS SQL: select scope_identity()
Access: select @@identity
---
Year happy = new Year(2007);
|
|
|
|
|
Question.
If the affected Rows are more than 1 do the above statements return one ID or more?
|
|
|
|