|
This[^] article may help.
/ravi
|
|
|
|
|
hello how do I break the code of a rectangular matrix to determine the no of columns that don't contain any zero element
|
|
|
|
|
sammathews wrote: using class string
|
|
|
|
|
Sounds like homework to me!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You have a two-dimensional array of strings? And you want to test the members to see if any are empty?
I'm sure your teacher or textbook already gave you hints on how to do that.
|
|
|
|
|
How do you highlight a treeview node at startup?
I have the node needed from BuildNodeTree() as defaultNode, and the following in frmMain_Load
private void frmMain_Load(object sender, EventArgs e)
{
BuildNodeTree();
treeview.SelectedNode = defaultNode;
}
This doesn't highlight the node. I'm assuming because it hasn't displayed yet.
What are my options?
Thank you.
|
|
|
|
|
Nope. Having treeview.SelectedNode = treeview.Nodes[0]; inside a Form_Load() handler is sufficient provided the TreeView has focus. A lot of Windows Controls don't mark their selections when they don't have focus.
One way of getting there automatically is by making sure treeview.TabStop is true (default) and TabIndex is zero.
|
|
|
|
|
TabIndex = 0
That was it. Thank you again for your help today.
|
|
|
|
|
Setting HideSelection to false highlights the selection (although dimmed) even when the control does not have focus. Most windows controls have a HideSelection property.
|
|
|
|
|
|
Selecting node is highlighted by default. you can note that by change the background of the form.
|
|
|
|
|
Hello all, i had no problem at adding parameters to a stored procedure and puttng the result in a dataset until i stated trying this with a Stored Procedure with select * from table where column like something+'% that takes parameters..
The problem is that it says `invalid number` at runtime not when executing procdure at my editor, so the problem is passing the parameters but i couldn`t figure it out, btw i use Oracle;
Let me give you the codes of stored procedure and how i call it from c# :
<code>CREATE OR REPLACE PROCEDURE OGR_USER.studentfind(std_FName nvarchar2, std_LName nvarchar2, pRc out sys_refcursor)
as
begin
open pRc for select * from ogr_user.STUDENT WHERE FNAME LIKE std_FName+'%' AND LNAME LIKE std_LName+'%';
end;</code>
<code>OracleParameter std_FName = new OracleParameter("std_FName", OracleDbType.NVarchar2);
std_FName.Value = name;
std_FName.Size = 100;
comm.Parameters.Add(std_FName);
OracleParameter std_LName = new OracleParameter("std_LName", OracleDbType.NVarchar2);
std_LName.Value = surname;
std_LName.Size = 100;
comm.Parameters.Add(std_LName);
comm.Parameters.Add("pRc", OracleDbType.RefCursor).Direction = ParameterDirection.Output;</code>
i tried parameters type varchar, nvarchar thinking that it would make a difference but no luck, i would really appreciate if anyone could help me with this, something goes wrong when i use like and % because i used the same code without a like query and there was no problem
|
|
|
|
|
That's not a procedure; it's just a simple query -- pass it to ExecuteReader.
And try adding the percent signs when you set the parameter values:
std_LName.Value = surname + '%' ;
|
|
|
|
|
Thanks for your advice, tried adding '%' at the and of the value but still invalid number at run time..it is somewhere in parameter setting and adding that i should add something but still could`t figure it
|
|
|
|
|
Within a loop, I am creating an unknown number of objects. The object has 3 properties. This object has a ToString override. Directly after that object is created, it is added to a list and added as a node, and the ToString override is the visible node text.
So what is actually stored in the treeview (text or the object) and how do I retrieve the object/get at it's properties when the node is selected?
Thank you.
|
|
|
|
|
What is in the TreeView is whatever you added to it, from the sound of it, instances of your little class. Those instances get stored in the Nodes collection, on which you can operate with a set of methods, and which you can index like an array.
|
|
|
|
|
Thank you.
df is the name of the object created in the loop.
when using:
myNode = new TreeNode();
How do I add the object? Currently I think I'm only adding a string by using:
myNode = new TreeNode(df.ToString());
Your comments are appreciated.
|
|
|
|
|
as you seem to add just strings, all you've got in the tree is strings.
drop the ToString() and the tree will look the same but hold real objects now.
I think you should be able to figure that out yourself.
BTW: the same would apply to other list oriented controls such as ComboBox, ListBox, ...
|
|
|
|
|
I thought I could, but when using the object as the argument, I get an error
myNode = new TreeNode(df);
"Argument '1' cannot convert '...DetailFob' to 'String' "
Sorry if this is so simple. I did try this before posting.
|
|
|
|
|
Hi,
sorry I was wrong (I use ListBox a lot, and TreeView very rarely).
In ComboBox and ListBox, you can add arbitrary types as items to the list, and what you see is its ToString result (unless OwnerDraw is in effect); however in a TreeView the items have to be TreeNode instances (the tree needs a standard way to find its branches and leaves, a ComboBox/ListBox doesn't have any hierarchy) and what you see is the TreeNode.Text
I see basically two ways to store more than just a string in a TreeView node:
1. create a TreeNode as you did, and store a reference to your object in the TreeNode.Tag property, which is there for you to use any way you like; you still have to provide a Text to the TreeNode (which you did), and if you want Find() to be successful, you should also set the Name property to the text value.
2. create a new class, say MyTreeNode, inheriting from TreeNode. You still need to explicitly set the Text property (as well as Name for a successful Find), but you no longer need to use Tag. As we don't have multiple inheritance nowadays, if you wanted to store say a Form in a tree (Form inherits from Control), you would have to use the first way (with Tag).
The main difference between both methods is the Tag indirection: the first item would be myTree.Nodes[0].Tag in (1) and myTree.Nodes[0] itself in (2)
|
|
|
|
|
Thank you very much for your time Luc.
|
|
|
|
|
you're welcome.
|
|
|
|
|
Store the selected node into Treenode. After that you can get all properties of node through object of treenode.
|
|
|
|
|
In short, I need to be able to do this:
http://i6.photobucket.com/albums/y210/notsotragichero/Chrome.png[^]
I need to be able to add a small image in exactly the same spot Google has done here in Vista / 7.
I have tried numerous solutions over the past week, but can not get this to be fully functional. Even once the image is painted, the NC area will not refresh, unless it is clicked off of, even when using RedrawWindow(). It shows the painted image, and an un-rendered border / titlebar.
[DllImport("user32.dll")]<br />
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);<br />
<br />
private void OnTimer1Tick(object sender, EventArgs e)<br />
{<br />
RedrawWindow(this.Handle, IntPtr.Zero, IntPtr.Zero, 0x0400 | 0x0100 | 0x0001);<br />
}
*The tick is just for current testing purposes*
Is there something, hopefully simple, that I am missing?
Thanks,
Brandon
|
|
|
|
|
The best thing I know is to use a form without borders and do your own form borders. You can see that on chrome, msn messenger, media player and more.
If you do find a way to draw on that area, please post your answer.
Thanks
|
|
|
|