|
In a ToolStripDropDownButton, the check marks in the menu items are misaligned to the top, and the area in the left margin of each menu item (where the check marks are drawn) overlaps the text portion of the menu item. The check marks are also quite small.
Originally the ToolStrip's ImageScalingSize was 16x16. I've since changed it to 32x32 and changed out all the images. The only way the menu items render properly is if I change the ImageScalingSize back to 16x16. Here's a screen capture of the menu: Click[^]
How do I get the check marks to render properly?
XAlan Burkhart
|
|
|
|
|
Finally found a solution. It does not address why it happened, but it does cause the check marks to display as they should. My code below was adapted from this MSDN article[^].
CType(tb_Options.DropDown, ToolStripDropDownMenu).ShowImageMargin = False
CType(tb_Options.DropDown, ToolStripDropDownMenu).ShowCheckMargin = True
And if anyone knows why this might happen (never saw it before), feel free to chime in with my thanks.
XAlan Burkhart
|
|
|
|
|
Hey peepz,
After a big torture of searching i came 2 my last hope.
Situation :
I have a mdiparent where i open mdichild A. From mdichild A, i click a button to open mdichild B.
I "simply" want to pass a value from mdichild B to mdichild A(not a new form).
Question:
How can i get a value from form B to retreive this in form A(bouth mdichilds).
form.show =>opens a new form
dim formbla as new blabla =>opens also a new form
already tried a less best practice :
formA.lblDate.Text = DataGridView1.Item(9, i).Value.ToString()
but this only works when i use the show method...
I'm begging 4 help
Somebody?
Thx in advance
|
|
|
|
|
Have a read of these
Step by Step: Event handling in VB.NET[^]
Delegates[^]
and choose which one that best suits your needs
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
You could create a public method on formb that returns the value you want. Then call it from forma.
|
|
|
|
|
Hey,
First of all thx for the reply,reallllly appreciate that
Second my apologizes if i'm working on your nerve system.
I'm an advanced noob with vb.net
But can somebody explain it with some example's?
I checked the event tutorial but there must be a faster way no?(don't like to add classes for a single transport).
So i like the public method more, but can you show me an example how i should write the method in form b and how to access my values in form a?
Thanks again
|
|
|
|
|
You could do something like this;
Form 2 Code (The one you want to get some value from):
Private aValue as String = "Hello World!"
Public Function GetTheValue() As String
return aValue
End Function
Form 1 Code (The one wanting the value, code inside a button or where ever)
Public Sub DoSomething
Dim theOtherForm as new Form1
MessageBox(theOtherForm.GetTheValue)
End Sub
|
|
|
|
|
Thx 4 the reply,
Your solution works but not how i wanted...
avalue = "hello world"
if i load the form where i want to get my data from i do:
avalue = "changethevaluethatiwanttohave"
so i load that form and avalue is changed (on the form)
then if i go to the form where i want to get my data in
i do : GetTheValue()
but still giving me "hello world" back instead of changetevaluethatiwanttohave...
How come?because avalue is declared global but if i change my global var it wil not change when a call the function in the other form??
regards
|
|
|
|
|
This is occurring because you are creating a new form each time.
You would need to find the form you want to work worth and then call its method.
If you have a number of forms open, you could use the ApplicationOpenForms to find the reference e.g.
For Each theForm As Form In Application.OpenForms
If theForm.Name = "FormOrder" Then
MessageBox(theForm.GetSomeValue)
End If
Next
Or if you know the instance of the form exists you can just reference it directly;
Dim theForm as Form2
MessageBox(theForm.GetTheValue)
You would want to do some error checking to make sure you do end up with a reference to the target form and not a null.
|
|
|
|
|
Dave,
Thanks again you really are a patient man right?...
Anyway, I can find the form and i know that it exists i will pass some code to give you a better view before i stop working with mdi containers.(last question hehe).
what i realllllyy need to accomplish is this:
Form A is a list of costumers where i can fill in textboxes with data. If i want to change a costumers data i click on a button search. This will go to form B where i can search through a datagridview of custumers.If i click a celrow the row data has to go to form A in the txt's.
Form B code:
If Not (e.RowIndex = -1) Then
DataGridView1.Rows(e.RowIndex).Selected = True
End If
i = DataGridView1.CurrentRow.Index
formA.TextBox1.Text = DataGridView1.Item(0, i).Value.ToString()
enso....
simply explained is that i need a formA.show() before it will pass the dgvitems in the txt.
I work between 2 mdichildrens so i cannot do this, also not possible the work with new because the form is already opened.
Can somebody help me out of this misery???
Sorry for bothering
greetz
& thx dave;)
|
|
|
|
|
Ok, let me show you 2 methods;
The first is the cheap and easy dirty method............
In this example, there are 2 forms the first has a textbox and a button, the second a listbox and a button, the first calls the second to find the customer the user wants, then returns this top the first form;
Public Class FormMain
Private Sub ButtonLookup_Click(sender As System.Object, e As System.EventArgs) Handles ButtonLookup.Click
Dim selectForm As New FormCustomerLookup
TextSelectedCustomer.Text = selectForm.FindCustomer
selectForm.Close()
End Sub
End Class
Public Class FormCustomerLookup
Private ItemHasBeenSelected = False
Private Sub FormCustomerLookup_Load(sender As Object, e As System.EventArgs) Handles Me.Load
For x As Integer = 0 To 9
ListBoxCustomer.Items.Add("Customer" + x.ToString)
Next
End Sub
Private Sub ButtonSelect_Click(sender As System.Object, e As System.EventArgs) Handles ButtonSelect.Click
If ListBoxCustomer.SelectedIndices.Count > 0 Then
ItemHasBeenSelected = True
End If
End Sub
Public Function FindCustomer() As String
Me.Visible = True
Do While Not ItemHasBeenSelected
Application.DoEvents()
Loop
Me.Visible = False
Return ListBoxCustomer.Items(ListBoxCustomer.SelectedIndices(0))
End Function
End Class
The second method uses events;
Public Class FormMain
Private WithEvents selectForm As FormCustomerLookup = Nothing
Private Sub ButtonLookup_Click(sender As System.Object, e As System.EventArgs) Handles ButtonLookup.Click
selectForm = New FormCustomerLookup
selectForm.Show()
End Sub
Private Sub selectForm_CustomerSelected(item As String) Handles selectForm.CustomerSelected
TextSelectedCustomer.Text = item
selectForm.Close()
End Sub
End Class
Public Class FormCustomerLookup
Public Event CustomerSelected(ByVal item As String)
Private Sub FormCustomerLookup_Load(sender As Object, e As System.EventArgs) Handles Me.Load
For x As Integer = 0 To 9
ListBoxCustomer.Items.Add("Customer" + x.ToString)
Next
End Sub
Private Sub ButtonSelect_Click(sender As System.Object, e As System.EventArgs) Handles ButtonSelect.Click
If ListBoxCustomer.SelectedIndices.Count > 0 Then
RaiseEvent CustomerSelected(ListBoxCustomer.Items(ListBoxCustomer.SelectedIndices(0)))
End If
End Sub
End Class
|
|
|
|
|
Dave You are the sh*t (positif ofcourse)
Maybe for the people who browse to do the same with a datagridview :
If DataGridView1.SelectedRows.Count = 0 Then
RaiseEvent CustomerSelected(DataGridView1.Item(columnindex, rowindex).Value.ToString())
End If
Or something...
Dave is there is anything i can do 4 you just mail me on facebook (already send you a message)
Succes with everything and greetings from belgium
|
|
|
|
|
Dave,
Can you tell me what changes if i want to send my values to destination form?(using events)?
Before it was form 1 opens form2 you select a value and send back to form1 close form2
now i want form1 opens form2 and sends the values immediantly.
Can you provide my info about the change in code?
Thx in advance agian
greetz
|
|
|
|
|
You have all the information about events in the message I previously posted.
Providing your Form1 has subscribed to the events of form1, you can raise the event on Form2 from anywhere you want within Form2.
Cheers,
Dave
|
|
|
|
|
hmm Dave i'm not that good that i can apply your last comment into my project...
I searched whole day like crazy:
Your example:
Public Class FormMain
Private WithEvents selectKlant As FormCustomerLookup = Nothing
Private Sub ButtonLookup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLookup.Click
selectKlant = New FormCustomerLookup
selectKlant.Show()
End Sub
Private Sub selectForm_CustomerSelected(ByVal item As String) Handles selectKlant.CustomerSelected
TextSelectedCustomer.Text = item
selectKlant.Close()
End Sub
End Class
Public Class FormCustomerLookup
Public Event CustomerSelected(ByVal item As String)
Private Sub ButtonSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelect.Click
If DataGridView1.SelectedRows.Count = 0 Then
RaiseEvent CustomerSelected(DataGridView1.Item(2, 1).Value.ToString())
End If
End Sub
End Class
I just want to change your givin example.
So actually i start on formcustomerlookup and before i raise my event i want to open "formmain" and fill the textbox with the value.
do i have to switch the with event or??because i cannot move the
selectKlant = New FormCustomerLookup
selectKlant.Show()
Greetz Dave and hoping 4 some patience again...
|
|
|
|
|
There are two ways of looking at this situation:
1. mdiChildA creates the instance of mdiChildB so it can hold a reference to it.
2. mdiParent holds the children so it has a reference to all of them.
I prefer number 2 and when creating mdiChildB I would make mdiChildA raise an event that mdiParent responds to and creates mdiChildB .
All communication from the children I do by events to the mdiParent . The parent can then call methods/set properties in any other children that need to respond to events raised by others.
|
|
|
|
|
Hello All,
I am stuck with this problem and could sure use a hand. I am trying to open MS Project 2007 and connect to MS Project Server 2007 based on windows authentication all from either Excel 2007 or 2010.
Everything works fine on both versions of Excel if its running on a Windows XP machine. The problem occurs when I attempt to run the code in a Windows 7 machine with Excel 2010.
When the code gets to the Shell function, where it attempts to open MS Project 2007 and connect to MS Project Server 2007, the Error 53 message appears, file not found and that only on one machine, my bosses.
I've tried it on other similar machines and it runs well.(Win7 / Excel 2010)
On my bosses machine, I take the value that passes through the Shell function and paste it in the run command and it does what it should, opens and connects to MS Project Server.
Can anyone shed some light on this?
sServer = "http://xxx-xxx/XXX"
sServerString = "winproj.exe /s """ & sServer
Shell sServerString
I've already set the object before this, if it matters...
Set oP = GetObject(, "msproject.application")
Thanks in advance.
|
|
|
|
|
The first thing to try would be to put the full path and file name to winproj in the string. If that works then the problem lies in the OS not knowing where it resides.
sServerString = "C:\somefolder\subfolder\winproj.exe /s " & sServer
You could add a the path to Environment variables PATH statement
|
|
|
|
|
Hey Dave,
Thanks! Your suggestion led me to keep digging and it turns out that the Shell function was looking for winproj.exe in the Office14 folder and not the Office12 folder. The user has Office 2010, but MS Project 2007.
I went ahead and added the path for him. When i have time, which i dont I'll add some code to check for the version and determine what path to create or simply check for the existence of the file and folder....
Thanks again...
|
|
|
|
|
Glad you got there in the end
|
|
|
|
|
hi
i am a new user of vb and i would like to know how i can connect mysql database with my vb6.0 project. is there is connector setup will be there than how i can get this and how i will use that.
thanks
Regards
Umesh Chand Daiya
I will do my best?
The Web Soluution, Bikaner (Raj.), India
|
|
|
|
|
To connect MySQL to VB 6 you need to download the OBDC Driver for MySQL Here[^] although I would seriously recommend that you download Visual Basic Express 2010[^] and start your project with VB.Net. VB 6 was discontinued at least 6/7/8 years ago and is no longer supported. It would be much easier for you to find tutorials and stuff related to VB.Net these days, and would serve you in much greater stead. Good Luck whichever way you go.
Live for today. Plan for tomorrow. Party tonight!
|
|
|
|
|
No. Even before VB6 was launched ODBC was a deprecated technology. He should use ADO.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
Firstly, don't use VB6 unless someone is putting a gun to your head; even then think hard about the choice.
Secondly, use ADO not ODBC. You will need to download the MDAC library from Microsoft, I assume it is still available. You need at least 2.5 but later versions may still work.
The better option is to go with .net.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|