|
I m making the add ins for application .Problem is this when i m making a button using following syntex ,Please Give me some help regarding ...
osButton=(_Office.CommandBarButton)oCommandBar.Controls.Add(_Office.MsoControlType.msoControlButton,oMissing,oMissing,oMissing,oMissing);
osButton.FaceId=57;
But when i m running the program button is appearing in addin but the icon is not displaying .if i use caption instead of FaceId it is working mean the caption is displaying but icon is not .what is the problem i m trying to find but still not getting where the problem is bkz no prob with syntex bkz this code is working in another computer .(my os Windows 2000 advance server)
Thanks if u tried to find the solution
|
|
|
|
|
Hey everyone,
I have a problem with seting and expanding nodes in a explorer clone program I am trying to make. The problems comes as when I am trying to open a folder in the right side of the explore bar (the right side is a TreeView and the left is a ListView). I can't find a method that will allow me to change the selected node in a treeView and also expand it.
Please help.
Part of my program's source code is here
private void lv_ItemActivate(object sender, System.EventArgs e)
{
ListView lv = (ListView)sender;
foreach (ListViewItem lvi in lv.SelectedItems)
{
string fullPath = tvw.SelectedNode.FullPath.ToString() + "\\" +lvi.Text.ToString();
MessageBox.Show(lvi.Text);
DirectoryInfo di = new DirectoryInfo(fullPath);
if ((di.Attributes & FileAttributes.Directory)!=0)
{
//here is what I have being attempting but to no avil because the selected node property is read only
tvw.SelectedNode = new TreeNode(lvi.Text);
tvw.SelectedNode.FullPath = fullPath;
tvw.SelectedNode.Expand();
return;
flow
PS: Thanks for the help in advance, I am new to the forum and I hope I can contribute and learn a lot in here.
|
|
|
|
|
The TreeView.SelectedNode property is NOT read-only, but TreeNode.FullPath is (which you're trying to set). All you need to do is recursively find your TreeNode (based on the path if you like) and then set TreeView.SelectedNode to it. If you want to expand it, call the Expand method on your TreeNode .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hey thanks for the help,
I have being thinking of using the Parent property to recurse through the tree node, but I what I don't understand is that after this I am still going to find a full path, and I wondering what to do with that.
Thanks for the help.
|
|
|
|
|
You don't recurse up using the Parent , you recurse through the children using the Nodes property. All children have only one parent, so there's not even a need to use recursion since a simple iterative loop will work just fine. To find a full path, just split the string on the separate character ("\" by default) and look for the TreeNode with the given text like so:
public TreeNode FindPath(string path)
{
if (path == null) throw new ArgumentNullException("path");
string[] names = path.Split(PathSeparator);
return FindPathHelper(Nodes, names, 0);
}
private TreeNode FindPathHelper(TreeNodeCollection nodes,
string[] names, int iteration)
{
if (nodes != null && names != null &&
iteration >= 0 && iteration < names.Length)
{
foreach (TreeNode node in nodes)
{
if (string.Compare(node.Text, names[iteration], true) == 0)
return node;
TreeNode child = FindPathHelper(node.Nodes, names, ++iteration);
if (child != null) return child;
}
}
return null;
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello Heath,
I know this thread over 5 years old and I hope you're still subscribing to it. I'm also trying to expand the path to a specific node in a treeview (i.e. a node that has just been added by a user).
I almost understand your code example. However my question is, where did you get the TreeNodeCollection for the "Nodes" parameter in the initial FindPathHelper call (within the FindPath function)? I don't see it declared anywhere.
Thanks,
Sacha
|
|
|
|
|
As mentioned, "you recurse through the children using the Nodes property". The Nodes property is on TreeView class and on the TreeNode class (which is used to recurse into subnodes).
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]
|
|
|
|
|
i designed a form using datagrid to connect to database. It allow user to enter data but i can not validate the data that user provide.
Please help as posible as you can.
Thanks.
Mr Duc Linh Nguyen
|
|
|
|
|
There are many ways you can do this. One way is to handle the TextBox.Validating event (inherited from Control ) of the DataGridTextBoxColumn.TextBox property, which gets the TextBox that is hosted when the cell is in edit mode. If you wanted to validate input as they type, handle the KeyDown event of the TextBox as well.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Is anyone aware of a componant that allows the building of relational query between tables. Looking for something similar to Access or SQl server. I want to use this in a project I am building.
Thanks for any help.
Stephen
|
|
|
|
|
How can i drag the items in listview to a custom position
just like in windows explorer when you set a icon view and the autoarrange is off.....
please help me...
i set in the ListView the ListViewAlignment property to Default
and AutoArange to false but it has no effect...
again pls help!
helppppppppppp
|
|
|
|
|
Found this
article here on Code Project
|
|
|
|
|
Setting AutoArrange to false and setting ListView.Alignment to ListViewAlignment.Default only takes effect if the ListView.View is set to View.LargeIcon or View.SmallIcon . Is this the case as well?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i have done this... but i think that i must resolve some events and i dont know which one
|
|
|
|
|
i have done that but still not working
|
|
|
|
|
how to grab a frame from webcam in c# ?
thanks...
|
|
|
|
|
You can use either the SDK for the WebCam, obtained from the manufacturer's website (http://developer.logitech.com[^] for Logitech cams) or try the Windows Image Acquisition API, docs are found here[^].
RageInTheMachine9532
|
|
|
|
|
How do you do anything useful with the Scroll event for a DataGrid ? I ned to take some action depending on which portion of the grid is visible, but there's no FirstVisibleRow property, although there is a FirstVisibleColumn .
I could do this with the scroll bars in an MFC ScrollView, but I can't see it in .NET.
|
|
|
|
|
Oh what, you're saying their example for the Scroll event in the SDK docs that pops up a MessageBox every time you scroll isn't practical?!
You could simulate a FirstVisibleRow of sorts (if you're extending DataGrid , it would definitely make a good read-only property) by calling DataGrid.HitTest with coordinates that would always be in the upper-left corner, like 1, 1 .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
But the Scroll event has a EventArgs not a MouseEventArgs so I can't do a hit test can I? If I could find the position of the slider (relative to top & bottom of the scrollbar) that would be enough.
|
|
|
|
|
For one, you can get the mouse position in screen coordinates at any time from the static Control.MousePosition property, but you didn't read my reply so this really doens't make a difference.
When you scroll, obviously a new row is displayed at the top of the DataGrid , right? All you need to do is call HitTest with the coordinates 1, 1 (or new Point(1, 1) and that will get you the row currently at the top of the DataGrid 's view. This is a very simple workaround.
If you want the slider position, simply P/Invoke the SendMessage API and send the SBM_GETPOS message to the DataGrid control using its Handle property (the HWND for the control). This will get you a value of between 0 and 100, so you'll need to take the row height into account and calculate everything, but the workaround above is so much simpler and doesn't require you to P/Invoke anything (making your code more portable).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I did read your reply but didn't know that HitTest could be used for anything other than a mouse position - that's what the help for HitTest suggests.
But I'm still not getting there...
DataGrid.HitTestInfo hti = valueGrid.HitTest(1,1);<br />
int row = hti.Row;<br />
if (row >=0)<br />
{.......<br />
but row always gives -1 no matter where the scroll position is.
I've also tried
DataGrid.HitTestInfo hti = valueGrid.HitTest(valueGrid.Location);
but no joy, and even tried checking the point in the middle of the top left cell, but again always row = -1.
Obviously I'm missing something very obvious!
|
|
|
|
|
How can i Open OUTLOOK EXPRESS from another Application .Example Suppose I have a Button upon a form in C#.net and I want that I will click upon the button a Outlook should be opened .
Thanks
This is Jitendra
|
|
|
|
|
This is very simple!
Step 1: Create an instance of an System.Diagnostics.Process Object.
Example: private System.Diagnostics.Process process1;
Step 2: Set the properties of process1.
The following property is important: StartInfo.FileName
Example: this.process1.StartInfo.FileName = "[path]";
Step 3: Start the process.
To start the process you call the method Start().
Example: this.process1.Start();
If you need the complete code sample let me know.
Good luck!
|
|
|
|
|
You can shorten this procedure by using the static Start method.
Process.Start(path, arguments);
The parameter arguments is optional, so the method call will look like this.
Process.Start(path);
|
|
|
|