|
I'm building an application and I'm trying to use my own class which adds a bit extra information to a TreeNode. But even though I override ToString() when they are rendered by the TreeView they seem to use the standard TreeNode.ToString(). I'm guessing this is because when the TreeView iterates the Nodes it contains it treats them as TreeNodes. That would make sense. So the question is what is there a way to override TreeNode.ToString() or get the TreeView to treat the objects as MyTreeNodes rather than ordinary ones.
|
|
|
|
|
Hi!
I guess you'd have to override the Text property of TreeNode, not the ToString() method.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hi,
Mav is right - you need the Text property, but it is not declared as virtual so you cannot override it.
The displayed text can be set by using one of the constructors that takes a string, or you can set the value of the Text property directly. The TreeView just displays this value.
----------------------------
Be excellent to each other
|
|
|
|
|
Thanks guys...
Because i need my text to be somewhat dynamic I have done a RefreshText() method which will update the Nodes Text property to what it needs to be. I hoped there was a more elegant solution but it appears not.
Just means if I add a node I have to go down the tree and refresh all the nodes.. It seems to work.
Thanks for your help I'm still trying to get my head around virtual override new and derivation of classes and stuff.
|
|
|
|
|
Hello,
Had anyone tried to use TB_CUSTOMIZE message with WinForm toolbars. I have used SendMessage to display toolbar customization window but it just didn't help. Any suggestion/links will be appretiated.
Thanks in advance.
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
I developed a LDAP concept in C#, Having Groups combo, under every group nearly 3,000 users are there. Under Groups combo selectedindexchange() event I am filling Users combo(having 3,000 users nearly). For filling it is taking nearly 2min. In between if we select another group, Blank screen is coming. That is system is hanged and performance is very slow. To increase its performace i want to use cache concept. For that I want to store users under particular group in cache, when the second time same Group combo is selected It should come from cache but not from LDAP server.
How to develope it? Any body help me...it is very urgent to my client....My code is:
private void cboGroups_SelectedIndexChanged(object sender, System.EventArgs e)
{
cboUsers.Items.Clear();
Response.Flush();
try
{
LoadUsers("LS1");
}
catch(Exception ex)
{
if(ex.Message=="The server is not operational")
{
try
{
LoadUsers("LS2");
}
catch(Exception ex1)
{
if(ex1.Message=="The server is not operational")
RegisterStartupScript("script","alert('LDAP Server seems to be down, please contact City Insight administrator.');");
else
throw new Exception(ex1.Message);
}
}
else
throw new Exception(ex.Message);
}
}
private void LoadUsers(string ldapServerID)
{
string IPassAddress,IPassUsername,IPassPassword;
if(ldapServerID=="LS1")
{
IPassAddress=ConfigurationSettings.AppSettings["IPassAddress"].ToString();
IPassUsername=ConfigurationSettings.AppSettings["IPassUsername"].ToString();
IPassPassword=ConfigurationSettings.AppSettings["IPassPassword"].ToString();
}
else
{
IPassAddress=ConfigurationSettings.AppSettings["AltIPassAddress"].ToString();
IPassUsername=ConfigurationSettings.AppSettings["AltIPassUsername"].ToString();
IPassPassword=ConfigurationSettings.AppSettings["AltIPassPassword"].ToString();
}
cboUsers.Items.Clear();
if(cboGroups.Items.Count >0)
{
string ou=Session["ou"].ToString();
//string AdsiPath="LDAP://211.114.211.31/l="+cboGroups.SelectedItem.Text+",ou="+ou+",o=Managed iPass,dc=sc-m.net";
string AdsiPath=cboGroups.SelectedValue.ToString();
DirectoryEntry de = new DirectoryEntry(AdsiPath);
//de.Username="cn=LDAP";
//de.Password="LTDldn51";
de.Username=IPassUsername;
de.Password=IPassPassword;
DataSet ds=new DataSet();
DataTable newTbl=new DataTable();
DataColumn dc1=new DataColumn();
newTbl.Columns.Add("uid");
newTbl.Columns.Add("path");
ds.Tables.Add(newTbl);
foreach (DirectoryEntry ce in de.Children)
{
// //if(ce.SchemaClassName.Equals("inetOrgPerson"))
// //{
// ListItem newItemList = new ListItem();
// newItemList.Text=ce.Properties["uid"].Value.ToString();
// newItemList.Value = ce.Path.ToString();
// cboUsers.Items.Add(newItemList);
// //}
DataRow defRow = ds.Tables[0].NewRow();
defRow[0] =ce.Properties["uid"].Value.ToString();;
defRow[1] = ce.Path.ToString();
ds.Tables[0].Rows.Add(defRow);
ds.AcceptChanges();
}
DataView view = ds.Tables[0].DefaultView;
view.Sort = "uid";
cboUsers.DataSource = view;
cboUsers.DataTextField = "uid";
cboUsers.DataValueField = "path";
cboUsers.DataBind();
ListItem newItem=new ListItem();
newItem.Text="[Select One]";
newItem.Value="0";
cboUsers.Items.Insert(0,newItem);
de.Close();
}
}
Kiran
|
|
|
|
|
How can i show the y axis values on the curve i added to the graph
jeyakumar_indian
|
|
|
|
|
Dear All,
I need to convert the Excel file in the Following format to XMl file Specified Below..Please Help me to come over from this difficulty...
Taskid Name OutlineLevel Colvalue
110i Design 3 L4_R_D04.002
111i Coding 3 L4_R_D04.004
112i Testing 3 L4_R_D04.006
<tasks>
<task Taskid="110i" Name="Design" Oulinelevel="3">
<colValue>L4_R_D04.002</colValue>
</task>
<task Taskid="111i" Name="Coding" Oulinelevel="3">
<colValue>L4_R_D04.004</colValue>
</task>
..........
</tasks>
Thanks n Regards,
Ramya.R
|
|
|
|
|
Chk these links
http://forums.aspdotnetstorefront.com/showthread.php?p=4424#post4424
Another method
http://www.pointercorp.com/Excel2XML.htm
You need to do some changes to get the required output
|
|
|
|
|
how do I convert from one image to another using C#???
ex. from bmp to jpg or vice versa
|
|
|
|
|
Load the image into an Image object and save it to the new format.
---
b { font-weight: normal; }
|
|
|
|
|
Take a look at the code in BitmapManip[^] class.
Jon Sagara
Look at him. He runs like a Welshman. Doesn't he run like a Welshman? Doesn't he? I think he runs like a Welshman.
Sagara.org | Blog | My Articles
|
|
|
|
|
I want to get all img tags from local html file to edit src properties?
Can I use mshtml to do this?
Please suggest me some codes.
Thank you.
|
|
|
|
|
|
hai iam having two tables having a field id , the id should exist in the first table and it should not exist in the second table.i have used reader to check the first table(when id exists in the first table it should move to next table) and then i moved to the second table but its giving an error that reader is already open,first close the reader how to handle it?
|
|
|
|
|
This error comes because reader works in connected mode.
Sol 1:
You have to make two connection objects use first connection object to read using data reader and insert using the other connection object.
Sol 2:
Use a datatable and insert all the data from data reader to a datatable.
Now close data reader and now make a loop on datatable get every record and insert into next table.
(if u want to check id of record from the first table and then insert into second table then these are the solutions else please explain this question)
Do good and have good.
|
|
|
|
|
i have to check 1st table and then validate the 2nd table and then only i have insert so i have to use three connection object isit right,can we go for reader inside a reader and how to close the reader by reader.
|
|
|
|
|
Hi i think you can also use dataset containing those tables. try that
|
|
|
|
|
I am using a Thread.Abort to abort an SQL command when the user wants to stop the current execution of an SQL Command.
However, it seems to take a while for the ThreadAbortException to start up and cancelling the current execution. So I am wondering what takes place when the Thread.Abort that makes the SQL takes about 10-15 seconds to allow it to go towards the ThreadAbortException.
-- modified at 22:56 Thursday 23rd February, 2006
|
|
|
|
|
ThreadAbort can abort threads only when they are running managed code. When you called the method to abort the command, it probably was executing unmanaged code.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
This is a brutal way to cancel a SQL command. Ever considered trying SqlCommand.Cancel?
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
to do the SqlCommand.Cancel you probably would put that on ThreadAbortException............
|
|
|
|
|
Here's my situation: I have a database created with SQL Express. I have a VS solution that has a Windows Forms project. In the project I've added a datasource by clicking "Data->Add new datasource" I selected database as where to get the data from, then I selected my database, then I selected the tables that I wanted included in the DataSet. The dataset gets created all well and good. I add a dataset from the toolbox onto my form and set it's datasource property to my solution dataset. Then I add a binding source and set it's datasource to the list instance of the dataset (the one dragged from the toolbox) and it's datamember to the correct table. Then I bind all the controls on my form to the bindingsource. Then all I should need to do (according to everything I've read) is type:
this.Validate ();
this.epsBindingSource.EndEdit ();
this.epsTableAdapter.Update (this.oxfordDataSet.eps);
But this doesn't work, no data is ever added to the database. The Update method return 0 as the number of rows updated. I'm trying to add new data to the database, but it never works. I thought maybe it was something in the project or something I may have done wrong. So I created a completely new project added the datasource exactly how it should be done, and simply dragged the table I'm trying to update from the "Data Sources" window (in "detail" mode) onto the form and let the designer do everything for me. I typed my information into the form pressed the save button (on the bindingnavigator toolbar the designer created), but there was still nothing added to the database.
Any help on what I may be doing wrong would be very very appreciated. I've been dealing with this for a week and can't wrap my brain around why nothing is getting added to the database. I'm new to working with datasets, but I don't think I'm doing anything wrong.
- Aaron
|
|
|
|
|
I have a requirement for following matter. I have a MS word document any one can amend to it, but any one can't copy and paste it to their computer. I want to create a software tool for that. Please give me some ideas for that.
Lilupa.
|
|
|
|
|
I want set CheckBox is Items of DataGird In WinForm
Checkbox Items In A DataGrid WinForms C#
|
|
|
|