473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Treeview (Eric Moreau)

Hi Eric,

thnks for the help on your site. It's great. In your example you turned the
node grey and checked the color.

If e.Node.BackColor.ToArgb = Color.Gray.ToArgb Then
e.Cancel = True
Microsoft.VisualBasic.Beep()
Return
End If

I turned the font to italic and tried

if e.Node.NodeFont.Italic = True Then
e.Cancel = True
Return
End If

I keep getting "Object reference not set to an instance of an object.".
Could you or someone give me the right code?
Thanks,

Jerry
Sep 10 '06 #1
2 980
On Sun, 10 Sep 2006 22:37:44 +0200, "Jerry" <je******@gmx.netwrote:
>Hi Eric,

thnks for the help on your site. It's great. In your example you turned the
node grey and checked the color.

If e.Node.BackColor.ToArgb = Color.Gray.ToArgb Then
e.Cancel = True
Microsoft.VisualBasic.Beep()
Return
End If

I turned the font to italic and tried

if e.Node.NodeFont.Italic = True Then
e.Cancel = True
Return
End If

I keep getting "Object reference not set to an instance of an object.".
Could you or someone give me the right code?
Thanks,

Jerry
What you are looking for is:
If e.Node.NodeFont.Style = FontStyle.Italic Then

End if

The above is only valid if you specifically assigned a new drawing font to the node, otherwise, the
return NodeFont is Nohting (default) and "NodeFont.Style" will throw an exception.

Gene


Sep 11 '06 #2
The code is correct, just make sure that e.Node and e.Node.NodeFont have a
value (i.e. not Nothing):

If e.Node IsNot Nothing AndAlso e.Node.NodeFont IsNot Nothing Then
If e.Node.NodeFont.Italic Then
e.Cancel = True
Return
End If
End If

/claes

"Jerry" <je******@gmx.netwrote in message
news:ee*************@news.t-online.com...
Hi Eric,

thnks for the help on your site. It's great. In your example you turned
the node grey and checked the color.

If e.Node.BackColor.ToArgb = Color.Gray.ToArgb Then
e.Cancel = True
Microsoft.VisualBasic.Beep()
Return
End If

I turned the font to italic and tried

if e.Node.NodeFont.Italic = True Then
e.Cancel = True
Return
End If

I keep getting "Object reference not set to an instance of an object.".
Could you or someone give me the right code?
Thanks,

Jerry

Sep 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Peter Zentner | last post by:
Hi all, if I assign a context menu to a treeview and popup the contextmenu with the APP-key the context menu appears in the center of the treeview control and not at the selected treenode. Is...
0
by: **** KiteOregon **** | last post by:
I want to use a treeview but also have the ability to have some buttons that will allow me to set some attributes of the item in the tree view. ie.. Company -company a...
2
by: menon | last post by:
We have developed a asp.net application using Microsoft TreeView control. On the production machine the application works fine but when the same application is diployed on a server with windows2003...
1
by: Tom John | last post by:
Hi Can anyone advise me if there is any way of getting a Treeview Check box to show the three stages of being checked: 1. Blank 2. Checked (Gray Background) 3. Checked (Cleaar Background) ...
1
by: Eric | last post by:
I'm using the TreeView control in Selection mode. However, leaf nodes that have been selected show in the browser as a different color than ones that have not been selected just like HTML links...
1
by: Jase | last post by:
Hi, Simple question, how do you set up a treeview so that when 1 on the nodes is selected it sends text associated with that node to a text box? Thanks for any help Jase
4
by: Jerry | last post by:
Hi, I created a treeview. I filled it with all the nodes I need. Now I would like to deaktivate some nodes and activate them upon a given input. "isvisible" is readonly. Isn't there any...
3
by: SteveT | last post by:
I am trying to populate a TreeView with XML data within a DataSet. I don't see the property DataSource in the treeview, only a DataBinding. Can that property to be used to populate my TreeView or...
2
by: celoftis | last post by:
Using VS2005, ASP.NET. Check out the tree view on this page: http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.aspx When you hover over the border between the two...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.