943,712 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 1149
  • VB.NET RSS
Dec 24th, 2008
0

context menu and print preview problem

Expand Post »
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:
VB.NET Syntax (Toggle Plain Text)
  1. form2.show()
  2. form2.list2.ContextMenuStrip= form1.cmenu

in the print preview context menu item code:

Code:
VB.NET Syntax (Toggle Plain Text)
  1. PrintPreviewDialog1.document = PrintDialog1 'PrintDialog1 has a loop to print items of list1 in form1
  2.  
  3. 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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vbuser44 is offline Offline
2 posts
since Dec 2008
Dec 25th, 2008
0

Re: context menu and print preview problem

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:
VB.NET Syntax (Toggle Plain Text)
  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)
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008
Jan 4th, 2009
0

Re: context menu and print preview problem

thanks a lot for your help it worked
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vbuser44 is offline Offline
2 posts
since Dec 2008
Jan 6th, 2009
0

Re: context menu and print preview problem

Hi! Nice to hear that you got answer to your problem, could you please mark the thread as solved. Thank you!
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: I could use some help!
Next Thread in VB.NET Forum Timeline: C++ codes with vb.net





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC