Click here to Skip to main content
16,016,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm new in the vb.net environment as I'm used to coding in c#. I've copied the DataGridViewPrinter class to my project as I want to print the contents of my datagridview but I now get an error stating :

"Type 'DataGridView' is not defined" in the line below:
VB
Private TheDataGridView As DataGridView

Can someone please help? I need to finish this by tomorrow Afternoon.

Thank you in advance.
Posted
Updated 27-Jan-11 2:34am
v2

try and fully qualify it.
Dim Printer = New system.windows.forms.DataGridViewPrinterHelper
 
Share this answer
 
Do you have the following import?
Imports System.Data
 
Share this answer
 
Comments
Henry Minute 27-Jan-11 8:36am    
Why would he need that for a DataGridView, which is in the Windows.Forms namespace?
Ryan Zahra 27-Jan-11 8:44am    
My mistake, confused it with DataTable...sorry
yheyhe 27-Jan-11 8:43am    
Hi Ryan

Yes I do have it and it's not helping. Any other suggestion?
Ryan Zahra 27-Jan-11 8:45am    
As Minute said, DataGridView is in the Windows.Forms namespace, so you should try Imports System.Windows.Forms
yheyhe 27-Jan-11 8:54am    
Hi Ryan and Minute

I have tried what u both suggested and it now gives me an error stating the following:

Namespace or type specified in the Imports 'System.Windows.Forms' doesn't contain any public member or cannot be found.Make sure the namespace or the type is defined and contains atleast one public member.Make sure the imported element doesn't use any aliases.
Hi Ryan

Yes I do have it and it's not helping. Any other suggestion?
 
Share this answer
 
Comments
Henry Minute 27-Jan-11 8:39am    
Please use the 'Add Comment' rather than adding an answer. That way the answerer will get an Email that you have done so.

BTW: DataGridView lives in the Windows.Forms namespace NOT in System.Data so if your problem is a missing Import, that is the one you need.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900