|
I have heard good things about www.freetextbox.com, have not used it though. Well now that i have re read your question, you might also look at the writer project(http://gotdotnet.com/Workspaces/Workspace.aspx?id=ee974084-d5c2-44d5-a11b-b2efb96074f8)
it is a wysiwyg windows forms editor. Free textbox is prolly closer to what you need, but it is a asp.net control. =\
|
|
|
|
|
Thanks, Most of what I have seen are asp.net controls. Most of the winforms stuff is overkill. I will take a look at the links.
|
|
|
|
|
I am using a dtp on a form that has an OK button. If the user changes the hour on the dtp and hits the enter key, the OK button_Click event fires without the dtp hour getting updated. How can I prevent this behavior?
For example:
before entry, the dtpMyControl.Value.Hour == 1
the user enters a change so the control looks like 05:59:59
then hits the enter key (the '05' being highlighted)
the validation code that reads the hour still has dtpMyControl.Value.Hour==1.
|
|
|
|
|
I found my answer.
simply add a Focus call in the _Click handler like so:
private void buttonOK_Click(..)
{
...
buttonOK.Focus(); // If the dtp (or other) control didn't loose focus, it does now
...
}
|
|
|
|
|
Hi, guys
I need a time stamp, which can remember time when the source code is compiled for the first time. So DateTime.Now is useless.
How can I get it?
Thank you very much.
vigorous
|
|
|
|
|
You mean like the "File Created" date that every file on FAT/32, NTFS, and most other file systems has? If you want to access this from code, use the FileInfo class along with the local path of your assembly, which you can get form Assembly.GetExecutingAssembly().Location .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I know I am doing something silly, but I cant seem to access the Item property of a Hastable:
Hashtable myHash = new Hashtable();
myHash.Item;
Produces a build error
"System.Collections.Hashtable does not contain a definition for 'Item' "
But it sez in help that Item is a public property of Hashtable. Am using VS2003 Enterprise with Frameworks 1.1 SP1
Many thanks
|
|
|
|
|
In C# the "Item" property is accessed using indexer syntax. So instead you would write something like this.
Hashtable myHash = new Hashtable();
object value = myHash[key];
|
|
|
|
|
The Item property of HashTable is the indexer in C#. You access it using this syntax:
object val = myHash[objKey];
Charlie
if(!curlies){ return; }
|
|
|
|
|
Hi there!!
I´m having problems here. I want to make a drag and drop operation with a TreeNode of a treeview. I found that if I want to make the drag and drop operation with the TreeView it is possible. I just want to know if it is possible to make the same operation with only one node of the treeView.
Thanks for your help, Sérgio
|
|
|
|
|
That's what the TreeView.ItemDrag event is for. It fires when you begin dragging a TreeNode . To handle dragging and dropping within the TreeView , you additionally handle the DragOver and DragDrop events at a minimum.
There is actually a good example of handling these events in the documentation for the TreeView.ItemDrag event in the .NET Framework SDK.
Note that unless you serialize your TreeNode it will not be available to other applications (or AppDomains - without marshaling in the source application).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
i assigne a number from Databaseto ValueMemeber in combobox.and i tryed to use it from ComboBox.SelectedValue but it return an object type but i need the number on this object for select a value in another Table but is not working.
Thnaks i need help please
|
|
|
|
|
You need to cast the value.
E.g. int theInt = (int) ComboBox.selectedValue;
|
|
|
|
|
Thanks to reply me but i did this casting but it give me this message
specified cast is not Valide
Thanks for your time please help me
|
|
|
|
|
I'm not quite sure what you are trying to do but you can always use the debugger watch windows to determine the type of the object.
|
|
|
|
|
How are you loading the combo?
|
|
|
|
|
this my code:
private void cob_SelectedValueChanged(object sender, System.EventArgs e)
{
label1.Text = cbo.SelectedValue.ToString();
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = "workstation id=UNKNOW;packet size=4096;user id=sa;data source=UNKNOW;persist security info=False;initial catalog=TestDB;";
SqlCommand cmd = cnn.CreateCommand();
cmd.CommandType = CommandType.Text;
//int x = (int)cbo.SelectedValue;
cmd.CommandText = "Select * from Val Where Cat_ID = "+cbo.SelectedValue+"";
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds);
lst.DataSource = ds.Tables[0];
lst.DisplayMember = "Val_Name";
lst.ValueMember = "Cat_ID";
}
Thanks for your time ....
haytham
|
|
|
|
|
I assume that this is working ok? Or is it Returning the object name? If not, how are you filling the combobox, databind or by item? SelectedValue is only used with databinding, a ValueMemeber must be set.
webhay wrote:
label1.Text = cbo.SelectedValue.ToString();
The following will not work because it will return the object name.
webhay wrote:
cmd.CommandText = "Select * from Val Where Cat_ID = "+cbo.SelectedValue+"";
|
|
|
|
|
i filled the combobox with databind :
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = this.ConnStr;
SqlCommand cmd = cnn.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = this.SelectCommand;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds);
combobox.DataSource = ds.Tables[0];
combobox.DisplayMember = ds.Tables[0].Columns["Client_Name"].ToString();
combobox.ValueMember = ds.Tables[0].Columns["Client_ID"].ToString();
|
|
|
|
|
webhay wrote:
combobox.DataSource = ds.Tables[0];
combobox.DisplayMember = ds.Tables[0].Columns["Client_Name"].ToString();
combobox.ValueMember = ds.Tables[0].Columns["Client_ID"].ToString();
You are not properly binding your combobox. Try this:
combobox.DataSource = ds;
combobox.DisplayMember = "TableName.Client_Name";
combobox.ValueMember = "TableName.Client_ID";
Note it is not recomended to use `ds.TableName' for the datasource.
|
|
|
|
|
Thanks Brett
it is working now you are so helpful
thanks for your time
and it is working in early binding too...
Regards
webhay
|
|
|
|
|
Thanks Brett
it is working fine now.you are so helpful....
Thanks for your time....
it is working in Erely binding tooo...
;)
regards
webhay
|
|
|
|
|
I am writing an RSS reader in C# and I'm trying to write the contents of a TreeView to an XML file. I have tried using XmlWriter and have managed to write simple tree structures but I get confused when it comes to dealing with complex tree structures such as those that have multiple folders and sub folders.
I have tried searching Code Project and the Net but haven't had much joy in finding a solution. I have only been using C# for a few months and my programming knowledge is fairly limited.
Is XmlWriter the best way to write out a TreeView? How would you go about going through each of the folders and writing the feeds within them?
If there is anything else that I need to include let me know.
|
|
|
|
|
Not a very popular article but you can try: http://www.thecodeproject.com/csharp/treeviewtoxml.asp
XmlWriter should be very easy. If you run into any problems try using the XmlDocument instead.
|
|
|
|
|
hi..
let say i have 3 nodes in a TreeView
and i wanna swap the 2nd and the 3rd node..
here is my code segment.. but it doesn't work
TreeNode tempNode = treeView1.Nodes[1];
treeView1.Nodes[1] = treeView1.Nodes[2];
treeView1.Nodes[2] = tempNode;
the tree becomes a 5-node tree like this:
Node0
Node2
Node1
Node1
Node2
|
|
|
|