+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Topic: VB6 My NotePad Questions

  1. #1
    Spike's Avatar
    Spike is offline BigBlueBall Alumni
    Join Date
    May 2004
    Location
    Chicago(ish), IL, USA
    Posts
    2,753

    VB6 My NotePad Questions

    I have some random questions if anyone knows VB6 Language...becuase I'm making a homomade Text Editor, becuase IMO Notepad isn't the best...

    1. I have a menu item called Cut, that when clicked, does this: SendKeys "^(x)" which is the same as typing Ctrl-X on your keyboard. My question is: How would you do that with the Delete button, because I have a Delete menu item.

    2. I have one huge text box as my "notepad" area. If I click File...Print, the Print dialog pops up, but it prints the form. How can I make it print JUST the textbox contents, color and fonts and all?

    3. I have a menu item called Word Wrap. This is checked by default, but how can I make it work, including turning off the apparent 'read-only' property txtBody.MultiLine?

    4. How can I get my Save and Open dialogs to work and to open a text file and out the contents into txtBody or save the contents of txtBody in any format? I know it's cdl(my name that I named the CommonDialog Control is 'cdl'.).ShowOpen or cdl.ShowSave, and I know how to set all the properties and specific file types and tags and all of that, but I want to know how to either get a text file's contents and put them in txtBody, or save the contents of txtBody in any format, but .txt as default.

    Since I talked so much about the program, I'll put it up for download here. (WARNING: Direct Download) Feel free to Beta Test =) I'll post updates, so download the file, then click File > About to check the version.

    I have an odd felling Dave's gonna be answering most of my questions...

  2. #2
    Join Date
    Jun 2004
    Posts
    80
    I'll try to answer what I can, I don't have VB installed at the moment but I plan on installing it again, and it has been afew years since I have used to.

    1. I know VB assigns "codes" to each key on the keyboard, so I would make a form that you can tell it to print off the "codes" on the form to find out which code the delete button goes to

    Code:
    Private Sub Form_KeyPress(KeyAscii As Integer)
    Print KeyAscii
    End Sub
    But there is no number for the delete key.....which is very interesting

    2. I would think the Rich Text Box control would have that option itself

    Code:
    RichTextBox1.SelPrint
    that might be it, but I dont have a printer, so I wouldn't be able to test it

    3. I know there is a command you can do, because you can change that option in WYSIWYG mode with rich text boxes.

    4. You would have to change the types of files on the line of the command of ShowOpen. You would use ","'s and stuff like that. Try looking at the tool tip that pops up and see what that says, that has always helped me out.

    So sorry the answers are vague, it has just been years since I have used VB. But as I said, I am going to install it again, so I will edit my reply and make the answers more clear as I figure them out again, but I know at one point I knew how to do all of this.

    I would go to www.pscode.com because that has always been my best resource for VB, plus I have books and such too. but http://www.pscode.com is the best tip I could give you.

    I'll be back with the more correct answers

  3. #3
    Spike's Avatar
    Spike is offline BigBlueBall Alumni
    Join Date
    May 2004
    Location
    Chicago(ish), IL, USA
    Posts
    2,753
    OK, Here's what I have sop far about opening a file:

    Code:
    Private Sub Open_Click(Index As Integer)
        On Error GoTo Error:
        cdl.Filter = "Text Files *.txt|*.txt|Html and Htm Files *htm(l)|*.htm*|All Files|*.*"
        cdl.FilterIndex = 1
        cdl.DialogTitle = "Open..."
        cdl.InitDir = "C:\Documents and Settings\%CURRENT_USER%\My Documents\"
        cdl.ShowOpen
        
        'So what do I do here to put the text file into txtBody.text???
        
    Error:
        Exit Sub
    End Sub
    6-Year BigBlueBall Veteran. Respect yo.

  4. #4
    Join Date
    Jun 2004
    Posts
    80
    The Rich Text Box has nothing about opening a file? Because if it did, then that would make things alot easier.

    If it doesn't then I would only see the next solution as being you would have to first dim strings for certain ways of formatted text which would be pretty complicated.

  5. #5
    DJHyperbyte is offline Senior Member
    Join Date
    Jan 2003
    Location
    Netherlands.
    Posts
    2,584
    You want to look at the 'LoadFile' and 'SaveFile' memberfunctions of the RichTextBox control. You will probably come up with something like this:
    Code:
    RichTextBox1.LoadFile cd1.FileName
    Good luck and show us when done.

  6. #6
    Join Date
    Jun 2004
    Posts
    80
    i finally got VB back on my computer....maybe if you want you can link the source so people could take a look at it. im sure if enough people here know VB we might be able to make a nice open source bigblueball text editor haha.

  7. #7
    DJHyperbyte is offline Senior Member
    Join Date
    Jan 2003
    Location
    Netherlands.
    Posts
    2,584
    Better than EditPlus?
    On a side note, Visual Basic sucks. It's too limited and too instable.

  8. #8
    Spike's Avatar
    Spike is offline BigBlueBall Alumni
    Join Date
    May 2004
    Location
    Chicago(ish), IL, USA
    Posts
    2,753
    Hey, gimmie a break, this is my first working, useable application, and I'm taking VB6 as a class at school.

    On a side note: I'm almost done! Just a few small adjustments, but currently it's at version 0.9b.
    6-Year BigBlueBall Veteran. Respect yo.

  9. #9
    David's Avatar
    David is offline Administrator
    Join Date
    Apr 2003
    Location
    Seattle, WA
    Posts
    5,330
    I would have answered, if I had the time....

    Anyway, for the Word-Wrap, the only solution I can think of (Unless there is a .WordWrap property...) is that you make the RichTextbox extremely big, make it as long as the longest line you have. It can be done, but it'd be a pain.

    VB6 is an okay language, I can code it pretty well, and I've made literally hundreds of applications in it - From webservers to LAN-IM clients to database utilities to administration clients to remote access clients. I'm moving into C++ now, it's much more complex, but much better overall.
    Raining on the parade since 2003.

    Dave Amenta .com

  10. #10
    Join Date
    Jun 2004
    Posts
    80
    Yeah I really want to learn how to use C++, because people say if you want to make games, that is definatly the program to use, but the one I used just isn't that good, so I am thinking of getting Visual C++, even if it is an older version, because since I am comfortable with Visual Basic, I figure C++ will look similar and not too overwhelming for me at first. The coolest game I made in Visual Basics was this cheeze-o game called "Hover Wars" which was basically the up to down scroller game where you just fight an enemy boss, but the graphics were kind of fun.

    Anyways yeah, I looked at the Rich Text Box thing and couldn't find anything. But then I used my trusty www.pscode.com and found this code snipplet right way

    Code:
    '**************************************
    ' Name: Easy WordWrap in RichTextBoxes
    ' Description:Create a WordWrap function
    '     for your program using a RichTextBox in 
    '     one easy line of code!
    ' By: Matt Shrock
    '
    'This code is copyrighted and has' limited warranties.Please see http://w
    '     ww.Planet-Source-Code.com/vb/scripts/Sho
    '     wCode.asp?txtCodeId=2527&lngWId=1'for details.
    '**************************************
    
    RichTextBox1.RightMargin = RichTextBox1.Width
    And what do you know, it does work now it isn't the greatest looking thing when you look at yourself typing on the screen since it bumps for a second....but for a second. You'll get what I am talking about when you start typing. And FYI I put that code in the
    Code:
    Private Sub RichTextBox1_Change()
    area. Maybe you can send me the program when it is done! I would be glad to test it for you.

+ Reply to Thread
Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Topics

  1. MSN Messenger FAQ
    By shifter in forum Windows Live Messenger Support
    Replies: 17
    Last Post: 10-27-2006, 03:07 PM
  2. AIM frequently asked questions
    By DJHyperbyte in forum AIM Support
    Replies: 5
    Last Post: 01-27-2006, 01:41 PM
  3. 2 simple newbie questions
    By Diggsy in forum MSN / WLM Archive
    Replies: 8
    Last Post: 10-28-2003, 07:00 AM
  4. Webcam Questions
    By vgoklani in forum Yahoo! Messenger Support
    Replies: 2
    Last Post: 09-27-2003, 07:14 PM
  5. Ultimate Questions
    By Faizan in forum The BigBlueBall Lounge
    Replies: 11
    Last Post: 08-06-2003, 01:24 AM

Posting Permissions

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