Results 1 to 10 of 10

Thread: Inputbox/Output help

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2005
    Posts
    10

    Inputbox/Output help

    Im working on my first real attempt at making something in VB.Net 2002 Standard. Its a basic program and im sure is easy to do i just need to know how to get started. I have googled around but so far I dont seem to be able to find what i need, or at least i dont know if im asking the right questions for the right answers to get it.

    This is what Im wanting to do. I want to make a simple program that contains several inputboxes, in those boxes the user will be able to put in anything he/she wants to put in them. Now setting up all the boxes and labels is easy but its the finished output that I have a problem doing.

    Here is an example.

    There will be an inputbox for the user to put a website link into. Now after they put the link into the inputbox I want to have a button they can click that will automatically add some text onto it and send it to a text document like notepad and also automatically copy it into the clipboard so they can simply paste it anywhere they want to.

    Say if they put www.google.com and then hit the button I want the program to add some php code to it to make it appear as a code box instead of an active link so it would come out as ["code]www.google.com[/code"] Without the quotes of course, and send it to the notepad and the clipboard. Basically im wanting to use this as a template so that the stuff in the inputboxes can always be changed but the added code will always come out the same.

    Thats the basics of it. There will be several inputboxes and I would like to make it to where they fill them all in and click a single button and it sends all of the info to the clipboard at once.

    What im needing to know is what exactly would be the coding to tell it for each inputbox to make it add the extra text i need to each box and how to then tell it in one button to send it to the clipboard.

    I dont want it done for me i just need to know how to tell it to do this stuff. Like i said its a small thing but for a first timer its not easy.Any help on this would really be appreciated.
    Last edited by nerofiend; Apr 30th, 2006 at 07:56 PM.

  2. #2
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: Inputbox/Output help

    You need to read a basic Visual Basic .NET tutorial if you don't know how to put [ code ] tags around some other text. Also, the control you are referring to is a TextBox not an InputBox.

    VB Code:
    1. OutputText.Text = "{code}" & InputText.Text & "{/code}"
    2. ' change the { } to [ and ]

    As far as copying to the clipboad, you can search the help files and find the answer to that very easily.
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  3. #3
    Member
    Join Date
    Feb 2006
    Posts
    61

    Re: Inputbox/Output help

    VB Code:
    1. Private Sub WriteToFile(ByVal Data As String, ByVal FileLocation As String)
    2.         Dim Writer As New System.IO.StreamWriter(FileLocation)
    3.         Writer.WriteLine(Data)
    4.         Writer.Close()
    5.     End Sub
    6.  
    7.     Private Sub CopyToClipboard(ByVal Data As String)
    8.         Clipboard.SetText(Data)
    9.     End Sub

    any quesitons... AOL/AIM = "SN 0291FZ4Q v2"

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2005
    Posts
    10

    Re: Inputbox/Output help

    Quote Originally Posted by eyeRmonkey
    You need to read a basic Visual Basic .NET tutorial if you don't know how to put [ code ] tags around some other text. Also, the control you are referring to is a TextBox not an InputBox.

    VB Code:
    1. OutputText.Text = "{code}" & InputText.Text & "{/code}"
    2. ' change the { } to [ and ]

    As far as copying to the clipboad, you can search the help files and find the answer to that very easily.
    I tried using your example to do this but I cannot get it to work. I managed to get it to copy to the clipboard just fine with a bit of shortened code from the other example tyvm Corrupt. But All I seem to be able to copy to the clipboard is what is typed into the Textbox, the extra code isnt appended onto it like I need. Also in the code you posted, if i use it then it asks me to declare the variables for inputtext and the outputtext. I think that is where i am having the problems as Im not sure how or what to declare them as? Like I said im very new to this and am learning the only way I know how by just tossing myself in and hoping i can swim. I have many tutorials on VB.Net programming but im just not one of those that can read a book and learn much from it. I gotta do it to remember anything. Plus i got the full AppDev VB.Net training course thats like 27 CD's of info and the books to go with it. Its a bit overwhelming to learn especially since im simply wanting to make an automatic template and may never do it again.

  5. #5
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: Inputbox/Output help

    You must post the code you have for us to able to help you. We've pointed you in a couple directions (MSDN/Visual Studio Help files being the most useful) and if you don't post code then there is nothing more we can do except write it for you (which isn't likely to happen).
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2005
    Posts
    10

    Re: Inputbox/Output help

    Ok well this is what I did to get it to copy to the clipboard when i press a button.

    Code:
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            If (TextBox1.SelectionLength > 0) Then
                Clipboard.SetDataObject(Mid(TextBox1.Text, _
                TextBox1.SelectionStart, TextBox1.SelectionLength).ToString)
            Else
                Clipboard.SetDataObject(TextBox1.Text)
            End If
    That seems to be working fine. Although Im not sure how to modify it to make it apply to every textfield in the whole application at once instead of just TextBox1 like it is now. But ill get there, got a lot of reading till I understand more.

    The real problem im having is getting the correct code to append the extra text into the text that a user puts in the TexBox's. I guess its a problem that i cant figure out how to declare certain things.

    If I use this:

    Code:
    OutputText.Text = "{code}" & InputText.Text & "{/code}"
    ' change the { } to [ and ]
    Then I get a build error saying that I need to declare "OutputText.Text" and "InputText.Text" and thats what im not knowing how to do. Or maybe thats not the words you intended me to use and I should change them to something else?

    As far as other code I havent written any yet as the whole thing really only depends on those 2 functions to work. The copy to clipboard and appending the extra text to a texbox text.

  7. #7
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: Inputbox/Output help

    OutputText.Text needs to be changed to the name of the text box you are using to show the text in (or changed to the clipboard if that is where you want it to go). InputTest.Text must be changed to TextBox1 or whatever textbox you are using to get input from.
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  8. #8
    Hyperactive Member OMITT3D's Avatar
    Join Date
    Mar 2006
    Posts
    368

    Re: Inputbox/Output help

    To append text use TextBox1.AppendText("TextHere")

  9. #9

    Thread Starter
    New Member
    Join Date
    Oct 2005
    Posts
    10

    Re: Inputbox/Output help

    Thanks a lot for all the help everyone. Its doing technically what its supposed to do. There just seems to be one minor bug and im not sure what would be the proper work around for it.

    Since im using this code:

    Code:
    TextBox12.Text = "Offical Site: {code}" & TextBox3.Text & "{/code}"
    And there are about 13 Textbox fields it seems to want to refresh on each field. IE I can type what i want into Textbox1 and it outputs the proper output into Textbox12 like it should but as soon as I move on to say Textbox2 to enter the info into that one the text in the output box (Textbox12) refreshes and clears itself to put the new text that i am entering from Textbox2.

    Is there any way to tell VB that I want it to keep all the input from all the Textboxes in Textbox12 without clearing Textbox12? And one more important thing, is there a way to make each Textbox field have a Carraige return function at the end of each one?

    Here is what I mean:

    As it is now everything will come out as one long line of text onto the clipboard. I would like to get it to do an "Enter" function for a new line at the end of each Textbox.

    So that it comes out like this:

    Textbox1 "First line of text"
    Textbox2 "Second line of text"
    Textbox3 "Third line of text"
    Instead of:

    Textbox1 "First line of text"Textbox2 "Second line of text"Textbox3"Third line of text"
    I need to be able to add some carraiges in different places to make it look conforming and nice.

    I cant begin to tell you all how much this is appreciated. If this works out I may try to learn how to add some other functions to this later on after i get some experience and book smarts under my belt like a link verifier and other tools it could use. Thanks again for all the input so far folks.

  10. #10
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: Inputbox/Output help

    You need to read a basic tutorial. There are plenty of tutorials that let you do exercises as you go isntead of just reading.

    Some good tutorials/books can be found here: http://msdn.microsoft.com/vstudio/ex...g/default.aspx

    After reading a tutorial, if you still can't get this to work, then post all the code you are having trouble with here.
    Last edited by eyeRmonkey; May 4th, 2006 at 08:59 AM.
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width