|
Hi,
I would like know how I can close a MDI form from a menu while I click on another MDI form.
I have menu with 4 MDI forms. for example A,B, C, D. Load A, it opens, decide to open B, Once B is open, A form should close or any other MDI form that opens, should now be closed.
Any guidance will be very helpfull.
Thanks..
|
|
|
|
|
You'll have to have a collection that your Child forms reside in and contains which forms are open. Frankly, it doesn't sound like you're application is really a candidate for even being an MDI application.
|
|
|
|
|
Hi,
I have an Arm_View(ID, TypeID, Type,Mark, Model) on MDI Form and two comboboxes
TypeCombox binding with Type_viewBindingSource,Display Member(TypeName), Value Member(TypeID),
Selected Value (None)
MarkCombox binding with Mark_viewBindingSource,Display Member(MarkName), Value Member(MarkID),
Selected Value (Type_viewBindingsource-TypeID)
When I click on the TypeCombox for a type, the corresponding Mark shows on the MarkCombox and the Arm_view shows the correct record. But when I try to move away the TypeCombox, the cursor locks, I cannot move away from it.
On Load_event, I load only Arm_view and Type_view and set both of the comboboxes to null..
On TypeCombox_TextChanged, I load Arm_view by Type from the TypeCombox.text
On MarkCombox_TextChanged, I load Arm_view by Mark from the MarkCombox.text
Thanks a lot in advance
|
|
|
|
|
I don't know for this particular case, however in my experience some of the XyzChanged events in .NET also fire when a value gets assigned that is identical to the current value (so their name isn't really accurate!), so it *could* be that your one TextChanged event is firing the other and vice versa, resulting in a never ending loop (or even a stack overflow if you would have a DoEvents in there somewhere).
I suggest you try and break the loop by explicitly checking for a change inside the TextChange event, which probably means you need to add a class variable that holds the previous value. In pseudo-code (which may look a lot like C#) this would be:
class Qwe {
private string oldType;
TypeCombox_TextChanged(...) {
string s=TypeCombox.Text;
if (s != oldType) {
oldType=s;
}
}
You may or may not want to do similar stuff on MarkCombox_TextChanged, in a simple case like this it should not be necessary though.
|
|
|
|
|
Hi,
I am lost from what you suggested but I am suspecting that it has to do with the binding property or column TypeName on the datasource which also causes the form from closing. It throws an exception that cannot bind property or column TypeName on the datasource.
Thanks
|
|
|
|
|
Sorry, I didn't pay attention enough to the bindings. I haven't done this myself with bindings, I trust the idea remains the same (avoid the loop of events), the execution will have to be slightly different. I hope somebody will be able to give you more precise instructions, IMO it boils down to "don't set a binding again that has already been set".
|
|
|
|
|
Hi,
Once again thanks..I think I solve this issue..what I notice now is that on the MarkComboBox, it shows multiple marks of the same kind whereas I only want to show one mark..
thanks again
|
|
|
|
|
Hello,
I am not able to convert this function to VB code....
This is the javascript function to get the last digit of a GTIN number:
factor = 3;
sum = 0;
var gNum = '1234564020233'
for (index = gNum; index > 0; --index) {
sum = sum + gNum.substring(index - 1, index) * factor;
factor = 4 - factor;
}
cc = ((1000 - sum) % 10);
result = gNum + cc;
}
I have the problem to deal with the substring function.
Anyone can help?
|
|
|
|
|
OK, JavaScript substring returns the string enclosed by the start and ending values. In your case that would be index - 1 , and index . It appears that index starts out with the length of the string in gNum and goes backwards by -1 with each iteration.
|
|
|
|
|
factor = 3
sum = 0
Dim gNum As String = "1234564020233"
For index = gNum To 1 Step -1
sum = sum + gNum.Substring(index - 1, index - (index - 1)) * factor
factor = 4 - factor
Next index
cc = ((1000 - sum) Mod 10)
result = gNum + cc
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
Hi David,
I got this error:
System.Data.Index' is not accessible in this context because it is 'Private'.
|
|
|
|
|
It must be due to 'index' not being declared.
Try:
For index As Integer = gNum To 1 Step -1
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
any advice on how to scroll both text box at the same time ?
|
|
|
|
|
kun85 wrote: any advice on how to scroll both text box at the same time ?
Replace them with a DataGridView and scroll that. Two text-columns should do the trick
I are Troll
|
|
|
|
|
That only works well when the two texts have the same number of lines, and the lines of both texts are supposed to match up. The OP wasn't clear on this at all, it could equally well be about a table of content and the content itself (like the "Document Map" Word offers).
|
|
|
|
|
Luc Pattyn wrote: That only works well when the two texts have the same number of lines, and the lines of both texts are supposed to match up.
Needn't be the same lines, but there would have to be a relation between them. That's what I expect when someone wants to scroll the contents of two different containers simultaneous. It'd work best if both have an equal amount of lines, but the same applies to a textbox.
In that sense, a property-grid looks like two scrollable textboxes to me. One line, one record
I are Troll
|
|
|
|
|
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
ListBox2.SetSelected(ListBox1.SelectedIndex, True)
End Sub
If there is a chance that the two lists could have differing item counts then use the Try Catch block to avoid selecting an invalid index.
Good luck!
It was broke, so I fixed it.
|
|
|
|
|
Unfortunately a WinForms ListBox does not offer scroll events, so the only technique I'm aware of is by overriding its WndProc. Here[^] is an example (it is using C#, you can do the same in VB.NET).
Once you got scroll events, you can have the second ListBox mimic the scrolling of the first. You can also do it both ways, but then you probably need to be careful and avoid eternal loops.
|
|
|
|
|
Hello,everyone! I've knowan how to click treenode to make tabpages selected and show, but I don't want users could click the tabpage and selected one of them. I searched in internet and found that it should use a intenger such as "tab = 1" in some Tabcontrol and Tabpage events like this webpage said whick use TabPage1_Validating & TabPage1_Enter like below :
Private Sub TabPage1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TabPage1.Validating
If tab = 1 Then
e.Cancel = True
Else
e.Cancel = False
End If
End Sub
Private Sub TabPage1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Enter
tab = 1 ' setting the selected tab when user gets back to this tab
End Sub
I tried it and now the tabpage could not click,but when I clicked treenode, it could not selected tabpage too.In fact,I didn't understand how the code in the webpage made tabpage disable click after I looked up in MSDN...
Could anyone give me some suggestions and help? Thanks a lot!
|
|
|
|
|
Why not just scrap the TabControl and use a stack of Panels instead?
|
|
|
|
|
Is there a Gecko Layout Engine .net Module? I want to have my web browser use the gecko layout engine, but I don't know how I can make that happen other than if there were a .net module for it. Thanks.
|
|
|
|
|
there is a tool called "google"
enter the terms:
gecko .net
press the "search" button and .... something wonderful will happen
|
|
|
|
|
I have done that and yet I haven't found anything on it, so I was hoping to get a reply from someone that has used something like it, so I can use that too... Your reply was rude, and I don't appreciate it.
|
|
|
|
|
maybe you did it ... but you didn´t read the page ....
a few lines below the "main" article you would have found a reference to geckofx .... and that is what you (probably) need.
to moan about a correct, short info as "rude", will prevent a lot of people to answer you in the future.
|
|
|
|
|
thebiostyle wrote: I have done that and yet I haven't found anything on it,
Here[^] it is
There doesn't seem to be a .NET specific library.
I are Troll
|
|
|
|