
mooman_fl
Avatar/Signature-
Posts
194 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by mooman_fl
-
Actually I have another problem now. It seems that the "handle" I get is just the integer for the handle... not an IntPtr. If it was then I could use Control.FromHandle to get it I think. The IntPtr itself isn't necessarily a problem either since I have seen a method for getting an IntPtr from and integer (not sure how effective it is for what I am trying to do). The problem comes with the fact that I am using program called "dll_tool" from someone called "the_winch" to build a new standard DLL with a string table from the .NET DLL so that it can be used as a plugin. Instancing an IntPtr in a Public Shared function causes the build to fail. This is most likely a bug in the dll_tool... but last update from the_winch on this tool was a year ago so chances of it getting fixed might be slim. Any ideas on a possible workaround to get a grab on the main window would be appreciated.
-
I am currently writing a DLL plugin for the Dark Basic programming language. Unfortunately there is no command in this language to get the size of the main window, but I CAN get the handle of one of the controls (eg: button) on the form. I need to be able to pass this handle to my plugin DLL and use Reflection to access the properties of the main Form. Any suggestions on how I might accomplish this? Not had to use handles before so this is new territory for me.
-
Ok... after posting the above example it finally sunk in what Iceplug was saying... and the correcton Otani made. I got it to work with this code: string[] strTest = new string[]{"Line one", "Line two", "Line three", "Line four", "Line five"}; Color[] clrTest = new Color[]{Color.Red, Color.Blue, Color.Yellow, Color.Green, Color.Purple}; int i = 0; foreach (string s in strTest) { rtb1.SelectionColor = clrTest(i); rtb1.SelectedText = s + Environment.NewLine; i++; }[size=2][color=#006400][/color][/size] Or for the sake of completeness here is the VB example: Dim strTest As String() = New String() {"Line one", "Line two", "Line three", "Line four", "Line five"} Dim clrTest As Color() = New Color() {Color.Red, Color.Blue, Color.Yellow, Color.Green, Color.Purple} Dim i As Integer = 0 For Each s As String In strTest rtb1.SelectionColor = clrTest(i) rtb1.SelectedText = s + Environment.NewLine i += 1 Next[size=2][color=#0000ff][/color][/size]
-
I am trying to do something similar. The only difference that I can see is that I need the whole line colored. For some reason the first one gets set correctly... the remaining lines seem to be set to the right color and THEN get changed to the same color as the first line... the last line added in my example code below seems to be the correct color. I am guessing that it has something to do with the selection part but I have struggled with this for hours and can't seem to get it. Any help is appreciated. string[] strTest = new string[] {"Line one", "Line two", "Line three", "Line four" , "Line five"}; Color[] clrTest = new Color[] {Color.Red, Color.Blue, Color.Yellow, Color.Green, Color.Purple}; int i = 0; foreach (string s in strTest) { rtb1.Text += s+Environment.NewLine; rtb1.SelectionStart = rtb1.Text.Length - (s.Length+1); rtb1.SelectionLength = s.Length; rtb1.SelectionColor = clrTest[i]; rtb1.SelectionStart = rtb1.Text.Length; i++; }
-
Then substitute SortedList for Hashtable in your declaration... it works like a hashtable but can also be reference by index. It keeps the same order you entered the items in.
-
I would also suggest looking at a hashtable since it uses key and value pairs where the value is of type Object which makes it very flexible for what is stored. That would make it easy to find what you want regardless of the internal order of the list. You would simply call it like this: Dim hash as HashTable = New HashTable Dim portnumber as Integer = 1024 hash.Add("Port", portnumber) Messagebox.Show(hash.Item("Port").ToString)
-
LOL... put it in your FAQ
-
Make your separate EXE and call it normally with an undocumented commandline argument Like "update.exe -updateme"... when update.exe is started it will check for the -updateme argument. If it isn't there then it shuts down before displaying the update dialog. If it is there then it knows it was called by your program and continues as normal.
-
You can put a some code in the MouseUp event for the control. It is a quick and dirty way to handle it. [size=1][color=#0000ff]Private[/color] [color=#0000ff]Sub[/color] RichTextBox1_MouseUp([color=#0000ff]ByVal[/color] sender [color=#0000ff]As[/color] [color=#0000ff]Object[/color], [color=#0000ff]ByVal[/color] e [color=#0000ff]As[/color] System.Windows.Forms.MouseEventArgs) [color=#0000ff]Handles[/color] RichTextBox1.MouseUp[/size] [size=1] RichTextBox1.Select(RichTextBox1.Text.Length, 0)[/size] [size=1][color=#0000ff]End[/color] [color=#0000ff]Sub[/color][/size] What exactly are you hoping to accomplish? Are you trying to prevent the user from changing what is in the RichTextBox?
-
Thank you Nersus... somehow I had missed that class. That is exactly what I was looking for.
-
-
I am trying to make a new class, IndexedHashtable. The idea is that each DictionaryEntry in the hashtable has an index number that you can search by as well as by the usual method (by key name). I can get it to do this rather easy with the following code: Public Class IndexedHashtable Inherits Hashtable Public ReadOnly Property ItemByIndex(ByVal index As Integer) As DictionaryEntry Get Dim _index As Integer = Me.Count - 1 Dim item As DictionaryEntry If index > (Me.Count - 1) Then Throw New IndexOutOfRangeException For Each item In Me If _index = index Then Return item _index += 1 Next End Get End Property End Class The problem is that if I add items to the hashtable then iterate through the index the index numbers don't return the entries in the order they were added. Almost, but not quite. As an example, made a form with a button and add the following code: Dim count As Integer Dim test As IndexedHashtable Dim dict As DictionaryEntry test = New IndexedHashtable test.Add("First", "Uno") test.Add("Second", "Dos") test.Add("Third", "Tres") test.Add("Fourth", "Quatro") test.Add("Fifth", "Sinco") test.Add("Sixth", "Seis") For count = 0 To (test.Count - 1) dict = test.ItemByIndex(count) Console.WriteLine("Key: {0} Value: {1}", dict.Key, dict.Value) Next This produces the following output: Notice that index 0 is the fourth item that was added... everything else is in order. Is there a reason for this? Am I missing something? And most importantly is there a better, or more efficient way, of getting the results I am looking for?
-
This is a larger task than it sounds. Those controls are custom drawn. I know of no easier way of doing it. Instead you might want to look into a third party control like SyntaxEditor at http://www.actiprosoftware.com/Products/DotNet/SyntaxEditor/Default.aspx I know of no free solutions, however if you can find one post back. :)
-
How to display child window originated from parent application?
mooman_fl replied to Danmilkman's topic in Windows Forms
Ok... call me dense. Are you wanting to do this for windows within your own application or in another running application? The method is a bit different for each. -
Ok... gotcha. The problem is that the tab itself isn't part of the TabPage but a part of the TabControl as a parent of the page. You want the TabControl1.SelectedIndex event. [size=2][color=#0000ff]Private[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size][size=2] TabControl1_SelectedIndexChanged([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]Object[/color][/size][size=2], [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles[/color][/size][size=2] TabControl1.SelectedIndexChanged [/size][size=2][color=#0000ff] If[/color][/size][size=2] TabControl1.SelectedIndex = 3 [/size][size=2][color=#0000ff]Then[/color][/size][size=2] MessageBox.Show("Hello World") [/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size] That should be something like what you want. The index of course is 0 based so index 3 corresponds to TabPage4.
-
Just a silly idea.... change the name of the other tabs to something else. I usually do this anyway as a matter of course prefering a more descriptive naming convention like tbpOptions, tbpAppearance, tbpControls The problem being of course that since you have multiple tabs named the same thing all of them are firing a TabControl1.Clicked event.
-
Ok.... solution first: three text boxes on the form with two labels with a "/" as their text (1 between the first and second textboxes... and the second between textboxes 2 and 3).... then validating is as simple as using if statements in the OnChange event for each textbox to make sure that the input is a) numeric, b) the right length, and c) in the right range.... if not then reset the contents of the textbox. Upon submission of this form the three textboxes can be concatenated to what ever desired format the programmer wants. Many webpages use this same method or something similar. That having been said, I don't know what the insult Joe Mamma had made... but other than that I have to agree with him. I was immediately insulted by Drstein99's first response to Joe. It was arrogant and rude coming from someone that was here asking US for help. I would suggest that if any further help is wanted that fact should be kept in mind by the asker. Secondly... not only does the customer not always know what they want, often times the programmer doesn't either. This has been proven time and time again on this very forum (even I have been guilty of needing to be shown the light and a better way). Asking why is not only a time honored tradition here... but often times necessary to understanding the true nature of the problem. A simple "I have no choice about no mouse input... and I have to keep it to the most simple methods per the clients request" would have sufficed for me and most other forum members here. That having been said... Have a nice day :)
-
Hey, I need help with changing my profile...
mooman_fl replied to spartanM19SSM's topic in Suggestions, Bugs, and Comments
If you are logged in (which you should be if you posted), click the "Profile" button at the top of the page.... on the next page click the "Edit Avatar" link. The rest should be self explainatory. -
I have been fooling around trying to get a grasp of AppDomains. The following code works as intended. Is it recommended though? Or could it be that it only LOOKS like it is working? What I am trying to do is start an AppDomain and have it return a value. Pointless and stupid for the small example I have since obviously it is a waste of resources for something so small and not practical for the example. What I intend to do later is have it load a series of plugin assemblies, grab the names and interface types that they carry and pass this off as a return to the primary appdomain. (Not references to the assemblies, just info on them to be loaded in a listview box) That way the second appdomain can be unloaded releasing the resources to the pluginassemblies since it is no longer needed. All that my test does is start a new appdomain and call a method from the class to return a string value to simulate returning a value from another domain. I just want to make sure from some of the gurus here that I have my methodology correct on this and there aren't some major pitfalls with what I am intending. To use this... make a form with a single button named "button1". The first block of code is for the buttons click event.... the second block of code goes in the same namespace but as a separate class. Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click Dim domain As AppDomain = AppDomain.CreateDomain("TestDomain") Dim tester As TestClass = DirectCast(domain.CreateInstanceFromAndUnwrap(Application.ExecutablePath, GetType(TestClass).FullName), TestClass) Dim TestString As String = tester.TestMethod AppDomain.Unload(domain) System.Windows.Forms.MessageBox.Show(TestString) End Sub Class TestClass inherits System.MarshalByRefObject Public Function TestMethod() As String Return "Hello World" End Function End Class
-
I don't have all the commands off the top of my head or I would be more specific, but someone else here will I am sure or you might be able to google it from what I will tell you.... You need to get the handle of the process that carries the textbox and possibly the handle to the textbox on that form (or maybe just iterate through the controls using the forms handle to create a reference... haven't tried this with .NET). You might want to look up some information on subclassing in your favorite .NET flavor.
-
You can search on the web but I don't know about any HTMLTextboxes... of course you could always write your own control, but I think writing a full-fledged HTML parser and renderer is not really where you are wanting to go right now.
-
It could be listening for more data...I would say that it is also possible that it is freezing because of the writing to disk. Defrag and see if the freezing time reduces.
-
Exactly... you make a reference to your interface and then DirectCast the plugins interface to your referenced interface.