That's what I thought - unfortunately that event does not fire for me.... Is there a setting in the parent that could prevent that event from firing ? Georg
Georg Kohler
Posts
-
Detecting when a child form is being moved -
Detecting when a child form is being movedI was wondering if somebody can point me in the right direction on this - The goal is to detect when a child form is being moved and read out the current position while moving -I could use a timer to read out the current position - but at this point I have not been able to fire an event that indicates the form being moved or not ( grabbed by the tool bar that is) This is just a normal form with standard close minimize / maximize buttons (Not that that should make a difference I assume) What am I missing ? Any ideas ? Georg
-
How to add a "variable" to a delegate .. Can I do This ?That sounds good - but correct me if I'm wrong - I don't think you can use a variable in an Address of statement. So somehow you would have to create another delegate for the adress of statement ??? I did try lot's of different ways a while back - non of them worked ...meaning I was somehow not on the right track :-O Can you give me a short example of how your would do this?
-
How to add a "variable" to a delegate .. Can I do This ?Below is portion of my current code ... obviously I'm having a serious problem with this :) Here is my question: In the following line I need to replace one of these two entries with a "variable" AddHandler Io_event.Input0, AddressOf F_DriveOK Any ideas on how to do this ? I need to add these handles dynamically - meaning the customer can change the mapping and therefore I need to update the handler to point to A) a different Address or B) change the input that point to a specific address What I have now works but is already pages long as I already have +40 Inputs and +25 Mapto locations :doh: It's definitely time to fix this ....
Public Sub Add_InputHandle(ByVal VirtualNumber As Integer, ByVal MapTo As Integer)
Select Case VirtualNumber Case 0 Select Case MapTo Case 0 AddHandler Io\_event.Input0, AddressOf F\_DriveOK Case 1 AddHandler Io\_event.Input1, AddressOf F\_DriveOK Case 2 AddHandler Io\_event.Input2, AddressOf F\_DriveOK
.....
.....
.....
End SelectCase 1 Select Case MapTo Case 0 AddHandler Io\_event.Input0, AddressOf F\_Estop Case 1 AddHandler Io\_event.Input1, AddressOf F\_Estop Case 2 AddHandler Io\_event.Input2, AddressOf F\_Estop
.....
.....
.....
End Select
End selectThanks Georg
-
How to search In a Structure ?Well if that's the "only" way, a Hashtable will be a lot faster I just can not belive there is not another way of indexing a Structure . One would think that indexing / searching is probabaly one of the most required tasks to be performe with a structure - But I might be wrong :-) Georg
-
How to search In a Structure ?Before I go crazy on this I was wondering if somebody could point me in the right direction :-) I was trying to use a structure to store "datasets" Anyway: Creating / populating the structure seems straight forward
Public Structure Test_Structure
Public Name As String
Public MapTo As String
Public Description As String
'......
'....
End StructureDim TEST(10) as Test_Structure
Test(0).Name = "FirstName"
Test(1).Name= "SecondNameBut How do I now search / get the index for the Dataset containing the .name "FirstName" Should I use a Hashtable to store the index ???? Thanks georg
-
How to Add Carriage return line feed to string (globalization)Actually there is a difference - at least it seems to me :rolleyes:
ErrorMessage = "First Line" & vbCrLf & "second Line"
' This will produce a two line message
ErrorMessage = "First Line vbCrLf second Line"
' will not produce a two line message(maybe replacing VBCrlf with something else would also work - but here is my solution so far)
LogMessage = "First Line \n second Line"
LogMessage = LogMessage.Replace("\n", Environment.NewLine)
MSGbox(Logmessage) ' will again produce a two line message"First Line \n second Line" is what get's stored as a resource - as you can see it will be easy to change this into another language as you can add the line feeds wherever you need to. In my code I also add Variables to the message - again this will allow for easy translation into another language. A typical error message might look like this
" Error detected in line \VAR1 \n Dublicate \Var2 values detected!"
This might end up looking like this: ..... Error detected in line 12 Dublicate N values detected! ....
-
How to Add Carriage return line feed to string (globalization)Actually that's what I ended up doing last night .. I was just "fishing" to see if there is a different way to do this I ended up using @LF@ as the string to be replaced by the Environment.NewLine I have to look int using \n instead - stick to the standard if possible ... Anyway - thanks for taking the time to answer my question :-) As always "you guys" haven been great! Georg
-
How to Add Carriage return line feed to string (globalization)Here is todays little problem :-) Usually I would write soemthing like this : ErrorMessage = "First Line" & vbCrLf & "second Line" MSGbox(ErroMessage) - This will produce a two line message What I need to do is to write the code like this ErrorMessage = "First Line ??Linefeed?? second Line" - Notice This is just one continius string not an assembled string as in the original. MSGbox(ErroMessage) should then also display two lines How do I do this the most straigh forward way ? The reason I'm trying to do this is for globalization of our software This approach would make it easy to translate any error message into another language thanks Georg
-
Add handler during runtime "problem"Thanks - that makes sense ;)
-
Add handler during runtime "problem"Question: how do I get this to work with Option strict On ? I'll add a bunch of ToolstripMenuitems(dropdowns) at runtime and need to point them to ONE single click event handler It "all" works with Option strict turned off :confused:.. but the compiler dosn't like it with Option strict turned ON If I change in the event handler sub ByVal sender As ToolStripMenuItem to ByVal sender As Object The compiler complains inside the sub when trying to read the [sender.Text] value ... Whats missing ? I know it dosn't like the narrowing - but I don't know how to fix it ....
Dim test As New ToolStripMenuItem
AddHandler test.Click, AddressOf IO_selected ' ** handler to be added **
InputsToolStripMenuItem.DropDownItems.Add(test)Private Sub IO_selected(ByVal sender As ToolStripMenuItem, ByVal e As System.EventArgs)
IODataView.CurrentCell.Value = sender.Text
End SubThanks Georg
-
Option strict ON problem ..Thanks - you guys are great! I knew there had to be a simple solution .... ;) georg
-
Option strict ON problem ..I understand that .fromFile returns an Image = question remains what's the correct function to use to load my Bitmap file into my bitmap ?? How do I Convert it? I goggled it - but it seems everybody else has figured this one out or the offered solutions seem rather "complicated" to me Im I using the wrong Load function ? Is there a direct conversion from Image to Bitmap? Whats the "proper" way of doing this? Do I need to load it into an Image first and then use a conversion ??? Georg
-
Option strict ON problem ..I can not figure out how load the file into my bitmap without getting an error with Option Strict set to ON (It works fine with Option Strict OFF ..:-))
Public BitmapImage As Bitmap BitmapImage = Bitmap.FromFile(filename) ' where file name is soemthing like ' "C:\Project\Prolasspecial.bmp"
What's the "correct" way of coding this, so that Option Strict On will not complain :rolleyes: ?? Georg -
MenuStrip control searching by menue nameThis got me going ... not everything is working yet , but I was able to search based on a string Your where correct in that I had to set the .name also Thanks a lot
-
MenuStrip control searching by menue nameGood point - but I believe I did try this also last night as I changed the search String from "untitled(1)" to "untitled(1)ToolStripMenuItem" = added [ToolStripMenuItem] to the text property the same way as VB 2008 is doing it when you create a menuitem ... But I'll check again tonight :-) Georg
-
MenuStrip control searching by menue nameThats what I'm trying to do - but I can not figure out what "function" actually lets you find an existing menu name based on a string Any idea how to actually do it ? Indexof / find/ index/ compare and so on have not worked for me (I might not call the correct menu tree as an example:
WindowName = "untitled(1)"
test = WindowsToolStripMenuItem.DropDownItems.Find(WindowName, True)
does not work ???? Where [WindowsToolStripMenuItem] is the actual menu that contains the menuitems I most be doing something wrong :confused: Georg
-
MenuStrip control searching by menue nameThis should be an easy one .. But I've been struggling all night over this ... - I'm adding menu items during runtime (keeping track of open files) - I can add the handler for the menu click event - that works .. Question: - How can I search / locate for the "newly" added menuitem just by its Menue NAME [untitled(1)] as an example - Is the best approach the use of a hash table ? (indexed by menu location ?) (I haven't tried this yet) - You would think there is an easy way of searching for the menu name direct ??? Here is how I'm adding the neue menu Item:
MenuName = "untitled(1)" ' Assigne window name
WindowsToolStripMenuItem.DropDownItems.Add(MenuName) ' add new created window to menue
Any ideas Thanks georg
-
How to access "my" toolbarbuttons from outside the main formVB.NET 2005 I have some toolbar buttons on my "main" form that i would like to access from another form Somehow, I have not been able to figure it out ... Inside the Main window I can use
DriveEnable.pushed =true
(where DriveEnable is the name of the actual button in the collection) and that works (of course :-O ) In my module I'm usingMain.Drivenable.pushed =true
.. but it does not work (no error either - just nothing happens) I have set all "possible" properties of the toolbar tool / button(s) to Public - doesnt seem to help me ..:mad: Whats the missing link ? -
Urgent: how to convert string into date in vb.netCheck this out _ I never used it myself - but stumbled over it over the last few days when trying to fix my late binding issue .. It copied out of the Help index Imports System Public Class ChangeTypeTest Public Shared Sub Main() Dim d As [Double] = - 2.345 Dim i As Integer = CInt(Convert.ChangeType(d, GetType(Integer))) Console.WriteLine("The double value {0} when converted to an int becomes {1}", d, i) Dim s As String = "12/12/98" Dim dt As DateTime = CType(Convert.ChangeType(s, GetType(DateTime)), DateTime) Console.WriteLine("The string value {0} when converted to a Date becomes {1}", s, dt) End Sub 'Main End Class 'ChangeTypeTest