Hello,
I've got a little program I whipped up and it looks very boring. I really like the way how vb6 is setup. Is there any graphics or pictures I can put on my form to make it look better?
Screen Shot:
Printable View
Hello,
I've got a little program I whipped up and it looks very boring. I really like the way how vb6 is setup. Is there any graphics or pictures I can put on my form to make it look better?
Screen Shot:
I have attached 403 .ico files that you might want to check out.
Thanks I wish I had those in the earlier stages of my project. But does anyone have like boarders or some kinda template I can use for a program that creates text files?
I've got a question with this...
is there a way to tell what line, and what colon the cursor is on in a rich text box?
Yes, getting the line is very easy since the RichTextBox has a GetLineFromChar method.Quote:
Originally Posted by paralinx
I add 1 to this since the line number returned is zero based. To get the current column position requires an API call and a simple calculation.VB Code:
MsgBox "The current line is " & RichTextBox1.GetLineFromChar(RichTextBox1.SelStart) + 1The above code sends the EM_LINEINDEX message to get the character index of the first character on the active line. Subtracting that from the current caret position gets the column position of the current line.VB Code:
Private Declare Function SendMessage _ Lib "user32.dll" Alias "SendMessageA" ( _ ByVal hwnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ ByRef lParam As Any _ ) As Long Private Const EM_LINEINDEX As Long = &HBB Public Function GetCol(rtfBox As RichTextBox) As Long GetCol = rtfBox.SelStart - SendMessage(rtfBox.hwnd, EM_LINEINDEX, _ rtfBox.GetLineFromChar(rtfBox.SelStart), 0) End FunctionVB Code:
MsgBox "Current column position is: " & GetCol(RichTextBox1)
thanks joacim it works perfectly :wave:
Add this to your form and see if you like it. I can't remember where I got it, but I've had it for a long time, and have used it many, many times.VB Code:
Private Sub Form_Paint() Dim lngY As Long, colorchange As Integer ScaleMode = vbPixels DrawStyle = 5 FillStyle = 0 For lngY = 0 To ScaleHeight colorchange = (255 - (lngY * 255) \ ScaleHeight) FillColor = RGB(colorchange, colorchange, colorchange) Line (-1, lngY - 1)-(ScaleWidth, lngY + 1), , B Next lngY End Sub
Ok, well joacim, I found a flaw in your code for the line and colon.
It won't go to the line and colon when i enter a few times, and then click up on a higher line. It will stay on the bottom one...
Sorry, but I have no idea what you mean? Can't you move the text caret? Aren't your display updated???
Ok it is kindof hard to explain but when I press enter 5 times it will give me line 5, but when i click on line 3 my label will stay on line 5. I think it's because I put the code into rtb_Change. Where should I put the code?
Oh I see, so there is actually not a flaw in my code but the flaw is in where you put the call :). Try rtb_SelChange instead.
Yes sorry didn't mean to say your code was bad. It's very very good :)
Ok now i've got another question for all you vb fanatics out there. How the heck do I use directory list box? I put one on my form but how do I tell it what to look for in the folders and to select the file and do something with it.
Add a FileListBox as well. This control has a Pattern property that you can change so it will show only files that matches that pattern (for example "*.txt" will only show text files). Now you need to sync the FileListBox with the DirListBox, which you do like this:VB Code:
Private Sub Dir1_Change() File1.Path = Dir1.Path End Sub
Ok now I've attempted to open up a text file with the file list box... with no success here is the code i tried:
VB Code:
Private Sub File1_Click() dircount = dircount + 1 If dircount = 2 Then Open Dir1.Path For Input As #1 txtWriteTab.Text = LOF(1) Close #1 dircount = 0 End If End Sub
What you are trying to do is to open a folder for Input instead of the selected file.VB Code:
Dim sFileName As String sFileName = File1.Path If Right$(sFileName, 1) <> "\" Then sFileName = sFileName & "\" End If sFileName = sFileName & File1.FileName Open sFileName For Input As #1 txtWriteTab.Text = Input(LOF(1), 1) Close #1