RSS Forums RSS

context menu and print preview problem

Please support our VB.NET advertiser: DiscountASP.NET – 3 Months Free on VB.NET Web Hosting
Reply
Posts: 2
Reputation: vbuser44 is an unknown quantity at this point 
Solved Threads: 0
vbuser44 vbuser44 is offline Offline
Newbie Poster

context menu and print preview problem

  #1  
Dec 24th, 2008
hi
I have two forms, form 1 has list1 and form 2 has list 2.
I need to use one context menu (cmenu)which is work in form 1 and it must be in work form 2 too the same context menu.. but there is a problem with Print Preview which is an item in the context menu when I right click in list 2 I see the items of list 1 in the print preview page.

how can I fix it??? first let me tell you what I did.

to make the context menu work in form 2 I wrote this:

Code:
form2.show()
form2.list2.ContextMenuStrip= form1.cmenu

in the print preview context menu item code:

Code:
PrintPreviewDialog1.document = PrintDialog1 'PrintDialog1 has a loop to print items of list1 in form1

PrintPreviewDialog1.ShowDialog()
it prints list1 when I click form1 or form2.
how can I make PrintPreviewDialog1.document = PrintDialog2 'to print list2 ??
I can't access the code to change the document according the source of right click if it was list1 to do this or if it was list2 to print the other document.
I tried to use class but I had problems too

thanks
AddThis Social Bookmark Button
Reply With Quote  
Posts: 650
Reputation: Teme64 is on a distinguished road 
Solved Threads: 106
Teme64's Avatar
Teme64 Teme64 is offline Offline
Practically a Master Poster

Re: context menu and print preview problem

  #2  
Dec 25th, 2008
It seems that form2.list2.ContextMenuStrip references to the list in form1. Create a copy of the form1.cmenu

I didn't fully test this but it should be very easy to do:
  1. Dim ArrItems() As ToolStripMenuItem
  2.  
  3. ReDim ArrItems(form1.cmenu.Items.Count - 1)
  4. form1.cmenu.Items.CopyTo(ArrItems, 0)
  5. form2.list2.ContextMenuStrip.Items.AddRange(ArrItems)
Reply With Quote  
Posts: 2
Reputation: vbuser44 is an unknown quantity at this point 
Solved Threads: 0
vbuser44 vbuser44 is offline Offline
Newbie Poster

Re: context menu and print preview problem

  #3  
Jan 4th, 2009
thanks a lot for your help it worked
Reply With Quote  
Posts: 650
Reputation: Teme64 is on a distinguished road 
Solved Threads: 106
Teme64's Avatar
Teme64 Teme64 is offline Offline
Practically a Master Poster

Re: context menu and print preview problem

  #4  
Jan 6th, 2009
Hi! Nice to hear that you got answer to your problem, could you please mark the thread as solved. Thank you!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the VB.NET Forum
Views: 637 | Replies: 3 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:21 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC