
teamdad
Members-
Posts
12 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by teamdad
-
Greetings.... This code lets me move "slide" a panel but it will let you pull it all the way off the forms edge or all the way back into itself and either case it just disapears. It needs to have a way to set a limit like a form has MaximumSize and MinimumSize type limits. Any thoughts on an easy way to get this to work on my panel? Maybe like if the panel is moved to a certian point that it stops moving or something. :-\ Dim _mouseDown As Boolean = False Private Sub Panel1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove If _mouseDown = True Then Panel1.Width = e.X Else If e.X >= Panel1.Width - 3 Then Panel1.Cursor = Cursors.VSplit Else Panel1.Cursor = Me.Cursor End If End If End Sub Private Sub Panel1_MouseDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown _mouseDown = True Panel1.Cursor = Cursors.VSplit End Sub Private Sub Panel1_MouseUp(ByVal sender As Object, _ ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp _mouseDown = False Panel1.Cursor = Me.Cursor End Sub
-
I have a class that I came up with an have been modifying for some time now that will allow you to embedd *.wav files into your project and you can use them interactively within your program. It saves time and efforts of making sure the files are in the same directory etc... My question is this; how can a *.chm (help file) that is embedded into the project be called upon (opened) with a button on the main form? Suggestions, thought, comments and strange looks are appreciated :D
-
I'm toying around with a numbers based card game I am making and I have hit a brick wall. Being kinda new to .NET isn't helping any either. Here's the plot for the settings of the game. I have TextBox1, 2, 3, 4 and 5 that are inputs. 1 is for number of players, 2 is for the number of cards to be dealt each player, 3 & 4 are lowest & highest range of the face value of the cards that only use numbers ex: 02, 06, 08, 10, TextBox5 is the multiline output for the players and cards. In theory when the inputs have their variables entered they will be the controling factors for the program. Dim Ione = TextBox1.Text Dim Itwo = TextBox2.Text Dim Ithree = TextBox3.Text Dim Ifour = TextBox4.Text Dim Ifive = TextBox5.Text Dim r As New System.Random() Dim Ifive = r.Next(Ithree, Ifour + 1) Problem 1. Dynamically adding the number of players by the number input into Ione -each player is then represented by a diffrent row in Ifive since multiline is True. I havent been able to come up with anything that will let me do this at all. Problem 2. Same type of issue with Problem 1 above. The number of cards dealt to each player tells each row of Ifive how many individual cards it needs to contain and that each card should be represented by a seperator with a specific format [the number] ex: bad visual output below. Problem 3. Incorperate Ithree and Ifour into the calculation to randomly pick numbers from the range that become the cards selected to be given to each player. In the below example: Ione had the number 3 typed in for three players "three rows" Itwo had the number 5 typed in for five cards dealt to each player Ithree had the number 2 typed in for the lowest card value that could be dealt to each player Ifour had the number 20 typed in for the highest card value that could be dealt When Button1 is pressed it will tell Ione to create the three rows in Ifive, it will tell Itwo to tell each row in Ifive that they will be dealt 5 cards, Ithree and Ifour will tell each card what the face value will be. The output in Ifive should look something like this bad visual. All this should happen all at the same time with the one button clicked. [02] [05] [07] [09] [10] [04] [09] [11] [15] [20] [08] [02] [16] [05] [18] Eventually I will work with PrintDocument to print out the information for the number of players, cards they were dealt and who won. That's on the back burner till I can get this thing going. Now, is there anyone brave enough to either point me in the direction of combining all this information or better yet.... help me with code snippets that can get me started. Thanks in advance to the brave that do end up helping me :eek:
-
users would only be able to type "change" the numbers in textbox1, textbox2, textbox3, textbox5, textbox6, textbox8 and textbox9 only. Text boxes 4, 7 and 10 are for showing the answer to the equasion.
-
If this is an easy question please excuse me. I am new to VB.NET and have made a few small programs that randomize numbers but I want to learn some math now and need a working code example. I want to have a series of text boxes 1 thru 10. The math formula I need help with is below. If it's easy enough I would like the calculations to occur when the numbers are typed in the text boxes by the user like an on change event. If it's easier to use a button to do all the caluclations after the numbers have been entered in the text boxes that would be ok too. textbox1 minus textbox2 plus textbox3 = textbox4 textbox4 minus textbox5 plus textbox6 = textbox7 textbox7 minus textbox8 plus textbox9 = textbox10 Thanks for help with this.
-
I am having a problem with getting a menu item to check or uncheck. Any suggestions on what's going wrong with this? It obviously keeps the form on top of other windows when I can get it working. Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click If MenuItem3.Checked = False Then Me.TopMost = False Else MenuItem3.Checked = True Me.TopMost = True End If End Sub Thanks in advance for those that reply
-
I am trying to learn how to write com objects " DLL files " that can be scripted with Windows Script Host to provide an interface for a form. Does anyone have pointers or a few good sites that have has tutorials on writing the dll code with vb.net? I found some on the web that already provide this functionality but I wanted to use my own work instead of having to borrow someone elses work. Thanks in advance
-
I use the following code to write individual lines into a text file: Dim m_strTestFile As String = "c:\test.txt" Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim writer As New IO.StreamWriter(m_strTestFile) writer.Write(TextBox1.Text & vbCrLf) writer.Write(TextBox2.Text & vbCrLf) writer.Write(TextBox3.Text & vbCrLf) writer.Write(TextBox4.Text & vbCrLf) writer.Flush() writer.Close() End Sub The test.text file looks like this with the text that has been typed in the boxes. Text Box Line 1 Text Box Line 2 Text Box Line 3 Text Box Line 4 If say the boxes were reset and did not have text in them any longer, how can I use the IO.StreamReader to recall the individual lines back into the text boxes they were written in originally with another button click? Would it be easier to use an xml format and if so could someone give an example of both read and write to get me started in that direction? Thanks in advance
-
I have been trying to debug my code to do two things and I need help with it while I am just starting out with vb.net My code below is pretty straight forward, I would like to see by what means I could add code to see if an existing instance of the program I want to bring active exists. If it does exist then it would be activated with focus. If there isn't an instance of it open then a msgbox would pop up with a warning notice to open the needed program or file and retry again. **Would AppActivate or something like Shell ("notepad", vbNormalFocus) be better to use? Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click AppActivate ("Document - Wordpad") Dim blog = TextBox1.Text SendKeys.Send(blog) End Sub Thanking the ones that reply in advance
-
Is there an easy way that can be explained on how to get vb.net to show text in the status bar when the curser is passed over a menu item and sub menu item? For example: clicking and then hovering your mouse on the word File brings up the text "Contains commands for working with the selected items."..... then when you hover the mouse down to the sub menu items with out clicking on them the text in the status bar changes to the description of what each sub menu item does. So far I have only got it to work by using the following code and it only works one time when the item is clicked on, it won't change the text when the mouse is moved to another item. I think there would need to be a response to MenuItem2 like a mouse over or something that would work but I haven't been able to come up with it either with just StatusBar1.Text or StatusBarPanel1.Text to specifically put the text in the first panel. Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click StatusBar1.Text = "This text shows in the status bar!" End Sub Thanking those that reply in advance.
-
I know I can use this code to write to a file with specific formats: Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim writer As New IO.StreamWriter("C:\test.ini") writer.Write(TextBox1.Text & " = " & TextBox2.Text) writer.Flush() writer.Close() End Sub But, how can I read the text from the file back into the orignal text boxes seperately like they were typed into in the first place by using a second button click? P.S. I would like to have 2 coloms of text boxes ligned up one beside the other and 3 text boxes in each stack for a total of 6 text boxes. To make things more complicated; I would need the file when saved to have each line separate. The file should look like this when saved. Text from box 1 = Text from box 2 Text from box 3 = Text from box 4 Text from box 5 = Text from box6 Any help with the proper code for both reading and writing like this is greatly appreciated by a newbie vb.net person.
-
I have the following code below for a small project I am working on and I need help to modify it. As it is; the code will produce an output that looks like this: Who: When: Why: I would like to have it use something like an if / then statement that would produce the output for the textbox only if there is something typed in the textbox and would skip over it if nothing was typed in the textbox. For example if only Who and Why had something typed in them. The output would look like this. Who: Joe Woods Why: Called in sick *********My existing code********* Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Label1.Text = "WHO" Label2.Text = "WHEN" Label3.Text = "WHY" TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox4.Multiline = True Button1.Text = "GO" End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strOutput As String strOutput = "Who:" & vbTab & TextBox1.Text & vbCrLf strOutput &= "When:" & vbTab & TextBox2.Text & vbCrLf strOutput &= "Why:" & vbTab & TextBox3.Text & vbCrLf strOutput &= "Test:" & vbTab & ComboBox1.Text & vbCrLf TextBox4.Text = strOutput End Sub ******************************** I was also wondering if it would be possible to have another button in the form that would somehow place the text from TextBox4 with it's orignal formatting to whatever other program the windows curser is in. ( like passing the text from this program to another program like Notepad ) If this isn't possible would I be able to copy the text from TextBox4 to the Windows Clipboard so I can then paste it into another program using Ctrl-V ( the standard paste method in Windows with the keyboard. ) Any help on this would be more than greatly appreciated. Thanks