Moving Lines Within A List Box
hello, i have a list box and i want to move some lines in it, but here is the catch;
i built the list like this: i have a 'brake' line and then some other lines starting with " " (4 spaces). it serves me as groups.
what i want to do is move the entire groups up and down. i keep failing on managing to do this..
it looks something like this:
brake1 line1 line2 line3 brake2 line1 brake3 line1 line2
i have between 2 and 10 brakes and as many lines between them.. (they also have unique names; not 'brake' and 'line').
also, the up and down buttons are only enabled when i'm on a brake. they are disabled seperatly when i'm on the first or last brake.
when i click on my up button (for example when i'm on brake3); it will replace brake2 and look like this:
brake1 line1 line2 line3 brake3 line1 line2 brake2 line1
and so is with the down button (on brake1);
brake3 line1 line2 brake1 line1 line2 line3 brake2 line1
after this, i also want to be able to move the lines up and down, but to disable the buttons when i'm on the first line and the last line.
(i only use 2 buttons; 'CmdUp' and 'CmdDown')
i use this line to tell when it's a line and not a brake; if left$(list1.listindex,4)=" " then blahblah..
i only managed to get the brake (any) to become the first of the list, and not even go down...
help? thanks in advance..
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Moving Lines In A Text Lines
I am creating a replay for a game and I am keeping the info for it in a text file but after 5 seconds I want to clear out anything over 5 seconds old and continue to add. I can figure most of it out cept for the whole part about it removing the first line and moving the rest of the lines up. I am adding to the file every 1/2 second for 5 seconds. Heres what I have so far....
VB Code:
Open "C:Game
eplay.txt" For Append As #1TotTime = Int(Timer) Print #1, Int(Timer); "lblbox(" & Index & ")"If Int(Timer) - TotTime = 5 Then
lol, not much but I can't figure out how do move the lines. Would I just kinda have a second file and copy the lines into the new file and just clear out the old one and so on? But that doesn't seem like an appropriate way to go. Any help with this situation would be muchly appreciated. Thank you and good day.
Moving Lines
I have a canvas to the right of a window and a toolbox to the left. The user drags elements from the toolbox to the left and drops them on the canvas. Then he can move the elements drawn on the canvas around it by dragging them around the canvas area. He can also link two or more elements by right clicking and dragging in between the elements he wishes to link on the canvas.
Till here all's working well. I am now attempting to move the links associated with an element while the element is being dragged (with the left mouse button) on the canvas. For this, I use rubber banding (the XOR raster operation R2_NOT). A snapshot shows you how it works as of now and what is the problem I am facing. Can you advise me why the lines are not being erased properly.
Code:
Private Sub picCanvas_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim LngCounter As Long
If Button = vbLeftButton Then
If LngNumberOfANSIToolsOnBoard > 0 Then
For LngCounter = 0 To LngNumberOfANSIToolsOnBoard - 1
If PtInRect(ANSIToolsOnBoard(LngCounter).Dimensions, X, Y) Then
LSet PreviouslySelectedToolOnBoard = ANSIToolsOnBoard(LngCounter)
CurrentOffsetX = X - ANSIToolsOnBoard(LngCounter).Dimensions.Left
CurrentOffsetY = Y - ANSIToolsOnBoard(LngCounter).Dimensions.Top
SelectedElementType = ANSIElement
LngToolIndexInToolBox = ANSIToolsOnBoard(LngCounter).DrawingToolIndex
BoolIsElementBeingDraggedFromCanvas = True
LngSelectedANSIToolOnBoardArrayIndex = LngCounter
EraseTextRectangle
Exit Sub
End If
Next LngCounter
End If
If LngNumberOfOtherToolsOnBoard > 0 Then
For LngCounter = 0 To LngNumberOfOtherToolsOnBoard - 1
If PtInRect(OtherToolsOnBoard(LngCounter).Dimensions, X, Y) Then
LSet PreviouslySelectedToolOnBoard = OtherToolsOnBoard(LngCounter)
CurrentOffsetX = X - OtherToolsOnBoard(LngCounter).Dimensions.Left
CurrentOffsetY = Y - OtherToolsOnBoard(LngCounter).Dimensions.Top
SelectedElementType = OtherElement
LngToolIndexInToolBox = OtherToolsOnBoard(LngCounter).DrawingToolIndex
BoolIsElementBeingDraggedFromCanvas = True
LngSelectedOtherToolOnBoardArrayIndex = LngCounter
EraseTextRectangle
Exit Sub
End If
Next LngCounter
End If
ElseIf Button = vbRightButton Then
In the MouseMove I call a method called MoveLinks in order to move the links associated with the drawing element while the drawing element is being moved.
Code:
Dim LngCounter As Long
MDI.sbrWorkflowDesigner.Panels("sbrpnlMouseCo-ordinates").Text = X & ", " & Y
MDI.sbrWorkflowDesigner.Panels("sbrpnlToolTips").Text = vbNullString
If Button = vbLeftButton Then
If BoolIsElementBeingDraggedFromCanvas Then
Call MoveTool(X, Y)
If PreviouslySelectedToolOnBoard.IsLinked Then Call MoveLinks(X, Y)
End If
ElseIf Button = vbRightButton Then
'Blah.....blah...blah...
The MoveLinks method is code listed below:
Code:
Public Sub MoveLinks(ByVal X As Long, ByVal Y As Long)
If PreviouslySelectedToolOnBoard.IsLinked Then
If PreviouslySelectedToolOnBoard.NumberOfLinks > 0 Then
For LngCounter = 0 To UBound(PreviouslySelectedToolOnBoard.Links)
MoveToEx frmCanvas.picCanvas.hDC, PreviouslySelectedToolOnBoard.Links(LngCounter).ToPoint.X, _
PreviouslySelectedToolOnBoard.Links(LngCounter).ToPoint.Y, _
ByVal 0&
SetROP2 frmCanvas.picCanvas.hDC, R2_NOT
LineTo frmCanvas.picCanvas.hDC, PreviouslySelectedToolOnBoard.Links(LngCounter).FromPoint.X, _
PreviouslySelectedToolOnBoard.Links(LngCounter).FromPoint.Y
MoveToEx frmCanvas.picCanvas.hDC, PreviouslySelectedToolOnBoard.Links(LngCounter).ToPoint.X, _
PreviouslySelectedToolOnBoard.Links(LngCounter).ToPoint.Y, _
ByVal 0&
SetROP2 frmCanvas.picCanvas.hDC, R2_NOT
LineTo frmCanvas.picCanvas.hDC, X, Y
With PreviouslySelectedToolOnBoard.Links(LngCounter)
With .FromPoint
.X = X
.Y = Y
End With
End With
With PreviouslySelectedToolOnBoard.Links(LngCounter)
With .PreviousPassThroughPoint
.X = X
.Y = Y
End With
End With
Next LngCounter
End If
End If
End Sub
Moving Lines
I have a canvas to the right of a window and a toolbox to the left. The user drags elements from the toolbox to the left and drops them on the canvas. Then he can move the elements drawn on the canvas around it by dragging them around the canvas area. He can also link two or more elements by right clicking and dragging in between the elements he wishes to link on the canvas.
Till here all's working well. I am now attempting to move the links associated with an element while the element is being dragged (with the left mouse button) on the canvas. For this, I use rubber banding (the XOR raster operation R2_NOT). A snapshot shows you how it works as of now and what is the problem I am facing. Can you advise me why the lines are not being erased properly.
Code:
Private Sub picCanvas_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim LngCounter As Long
If Button = vbLeftButton Then
If LngNumberOfANSIToolsOnBoard > 0 Then
For LngCounter = 0 To LngNumberOfANSIToolsOnBoard - 1
If PtInRect(ANSIToolsOnBoard(LngCounter).Dimensions, X, Y) Then
LSet PreviouslySelectedToolOnBoard = ANSIToolsOnBoard(LngCounter)
CurrentOffsetX = X - ANSIToolsOnBoard(LngCounter).Dimensions.Left
CurrentOffsetY = Y - ANSIToolsOnBoard(LngCounter).Dimensions.Top
SelectedElementType = ANSIElement
LngToolIndexInToolBox = ANSIToolsOnBoard(LngCounter).DrawingToolIndex
BoolIsElementBeingDraggedFromCanvas = True
LngSelectedANSIToolOnBoardArrayIndex = LngCounter
EraseTextRectangle
Exit Sub
End If
Next LngCounter
End If
If LngNumberOfOtherToolsOnBoard > 0 Then
For LngCounter = 0 To LngNumberOfOtherToolsOnBoard - 1
If PtInRect(OtherToolsOnBoard(LngCounter).Dimensions, X, Y) Then
LSet PreviouslySelectedToolOnBoard = OtherToolsOnBoard(LngCounter)
CurrentOffsetX = X - OtherToolsOnBoard(LngCounter).Dimensions.Left
CurrentOffsetY = Y - OtherToolsOnBoard(LngCounter).Dimensions.Top
SelectedElementType = OtherElement
LngToolIndexInToolBox = OtherToolsOnBoard(LngCounter).DrawingToolIndex
BoolIsElementBeingDraggedFromCanvas = True
LngSelectedOtherToolOnBoardArrayIndex = LngCounter
EraseTextRectangle
Exit Sub
End If
Next LngCounter
End If
ElseIf Button = vbRightButton Then
In the MouseMove I call a method called MoveLinks in order to move the links associated with the drawing element while the drawing element is being moved.
Code:
Dim LngCounter As Long
MDI.sbrWorkflowDesigner.Panels("sbrpnlMouseCo-ordinates").Text = X & ", " & Y
MDI.sbrWorkflowDesigner.Panels("sbrpnlToolTips").Text = vbNullString
If Button = vbLeftButton Then
If BoolIsElementBeingDraggedFromCanvas Then
Call MoveTool(X, Y)
If PreviouslySelectedToolOnBoard.IsLinked Then Call MoveLinks(X, Y)
End If
ElseIf Button = vbRightButton Then
'Blah.....blah...blah...
The MoveLinks method is code listed below:
Code:
Public Sub MoveLinks(ByVal X As Long, ByVal Y As Long)
If PreviouslySelectedToolOnBoard.IsLinked Then
If PreviouslySelectedToolOnBoard.NumberOfLinks > 0 Then
For LngCounter = 0 To UBound(PreviouslySelectedToolOnBoard.Links)
MoveToEx frmCanvas.picCanvas.hDC, PreviouslySelectedToolOnBoard.Links(LngCounter).ToPoint.X, _
PreviouslySelectedToolOnBoard.Links(LngCounter).ToPoint.Y, _
ByVal 0&
SetROP2 frmCanvas.picCanvas.hDC, R2_NOT
LineTo frmCanvas.picCanvas.hDC, PreviouslySelectedToolOnBoard.Links(LngCounter).FromPoint.X, _
PreviouslySelectedToolOnBoard.Links(LngCounter).FromPoint.Y
MoveToEx frmCanvas.picCanvas.hDC, PreviouslySelectedToolOnBoard.Links(LngCounter).ToPoint.X, _
PreviouslySelectedToolOnBoard.Links(LngCounter).ToPoint.Y, _
ByVal 0&
SetROP2 frmCanvas.picCanvas.hDC, R2_NOT
LineTo frmCanvas.picCanvas.hDC, X, Y
With PreviouslySelectedToolOnBoard.Links(LngCounter)
With .FromPoint
.X = X
.Y = Y
End With
End With
With PreviouslySelectedToolOnBoard.Links(LngCounter)
With .PreviousPassThroughPoint
.X = X
.Y = Y
End With
End With
Next LngCounter
End If
End If
End Sub
Moving Lines
I have a canvas to the right of a window and a toolbox to the left. The user drags elements from the toolbox to the left and drops them on the canvas. Then he can move the elements drawn on the canvas around it by dragging them around the canvas area. He can also link two or more elements by right clicking and dragging in between the elements he wishes to link on the canvas.
Till here all's working well. I am now attempting to move the links associated with an element while the element is being dragged (with the left mouse button) on the canvas. For this, I use rubber banding (the XOR raster operation R2_NOT). A snapshot shows you how it works as of now and what is the problem I am facing. Can you advise me why the lines are not being erased properly.
Code:
Private Sub picCanvas_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim LngCounter As Long
If Button = vbLeftButton Then
If LngNumberOfANSIToolsOnBoard > 0 Then
For LngCounter = 0 To LngNumberOfANSIToolsOnBoard - 1
If PtInRect(ANSIToolsOnBoard(LngCounter).Dimensions, X, Y) Then
LSet PreviouslySelectedToolOnBoard = ANSIToolsOnBoard(LngCounter)
CurrentOffsetX = X - ANSIToolsOnBoard(LngCounter).Dimensions.Left
CurrentOffsetY = Y - ANSIToolsOnBoard(LngCounter).Dimensions.Top
SelectedElementType = ANSIElement
LngToolIndexInToolBox = ANSIToolsOnBoard(LngCounter).DrawingToolIndex
BoolIsElementBeingDraggedFromCanvas = True
LngSelectedANSIToolOnBoardArrayIndex = LngCounter
EraseTextRectangle
Exit Sub
End If
Next LngCounter
End If
If LngNumberOfOtherToolsOnBoard > 0 Then
For LngCounter = 0 To LngNumberOfOtherToolsOnBoard - 1
If PtInRect(OtherToolsOnBoard(LngCounter).Dimensions, X, Y) Then
LSet PreviouslySelectedToolOnBoard = OtherToolsOnBoard(LngCounter)
CurrentOffsetX = X - OtherToolsOnBoard(LngCounter).Dimensions.Left
CurrentOffsetY = Y - OtherToolsOnBoard(LngCounter).Dimensions.Top
SelectedElementType = OtherElement
LngToolIndexInToolBox = OtherToolsOnBoard(LngCounter).DrawingToolIndex
BoolIsElementBeingDraggedFromCanvas = True
LngSelectedOtherToolOnBoardArrayIndex = LngCounter
EraseTextRectangle
Exit Sub
End If
Next LngCounter
End If
ElseIf Button = vbRightButton Then
In the MouseMove I call a method called MoveLinks in order to move the links associated with the drawing element while the drawing element is being moved.
Code:
Dim LngCounter As Long
MDI.sbrWorkflowDesigner.Panels("sbrpnlMouseCo-ordinates").Text = X & ", " & Y
MDI.sbrWorkflowDesigner.Panels("sbrpnlToolTips").Text = vbNullString
If Button = vbLeftButton Then
If BoolIsElementBeingDraggedFromCanvas Then
Call MoveTool(X, Y)
If PreviouslySelectedToolOnBoard.IsLinked Then Call MoveLinks(X, Y)
End If
ElseIf Button = vbRightButton Then
'Blah.....blah...blah...
The MoveLinks method is code listed below:
Code:
Public Sub MoveLinks(ByVal X As Long, ByVal Y As Long)
If PreviouslySelectedToolOnBoard.IsLinked Then
If PreviouslySelectedToolOnBoard.NumberOfLinks > 0 Then
For LngCounter = 0 To UBound(PreviouslySelectedToolOnBoard.Links)
MoveToEx frmCanvas.picCanvas.hDC, PreviouslySelectedToolOnBoard.Links(LngCounter).ToPoint.X, _
PreviouslySelectedToolOnBoard.Links(LngCounter).ToPoint.Y, _
ByVal 0&
SetROP2 frmCanvas.picCanvas.hDC, R2_NOT
LineTo frmCanvas.picCanvas.hDC, PreviouslySelectedToolOnBoard.Links(LngCounter).FromPoint.X, _
PreviouslySelectedToolOnBoard.Links(LngCounter).FromPoint.Y
MoveToEx frmCanvas.picCanvas.hDC, PreviouslySelectedToolOnBoard.Links(LngCounter).ToPoint.X, _
PreviouslySelectedToolOnBoard.Links(LngCounter).ToPoint.Y, _
ByVal 0&
SetROP2 frmCanvas.picCanvas.hDC, R2_NOT
LineTo frmCanvas.picCanvas.hDC, X, Y
With PreviouslySelectedToolOnBoard.Links(LngCounter)
With .FromPoint
.X = X
.Y = Y
End With
End With
With PreviouslySelectedToolOnBoard.Links(LngCounter)
With .PreviousPassThroughPoint
.X = X
.Y = Y
End With
End With
Next LngCounter
End If
End If
End Sub
Selecting/moving Lines
Hey there, I am hoping someone can help me out? I have a picbox where someone can draw lines and circles. Allowing the person to draw is the simple part but... What I want to have happen is after a person is done drawing, I want allow them to be able to select a line/circle(ie. change the line/circle color) and then let them drag the line/circle to another location on the picbox? Any help would be greatly appreciated!
Lines Moving Around On My Form
Here is a real strange thing that happens. I have a form where there are a few collumns being totaled. under the cells I want to total I have drawn a line, and put the totals under the line like this
1 2 3
2 3 1
________________
total 3 5 4
Sometomes when I come back to my form, the lines are moved and sized much shorter. I have to reposition them. Anyone heard of such a thing?
Stop A Moving Image Drawing Over Other Lines...
I have the following code which moves a little image control across the form, but what happens when it moves across slowly is it sort of half draws over lines that I have on the form....how can i get it so that it doesnt draw over the other lines and leaves them intact....so that it doesnt leave this kind of trail.....
VB Code:
Private Sub Timer1_Timer()If Image2.Left < 9240 Then Image2.Left = Image2.Left + 1'only move the picture one space over if it isnt alreadt at the desired locationEnd IfEnd Sub
Move Lines From List Box To List Box
G'day,
I found the attached program on the net and would like to use it with listboxes in a control array instead of separate list boxes as I have over a dozen of them.
I am running around in circles trying to do it. Can someone help me?
Peter
Lines In A List Box
Is there any way I can find how many lines are displayed in a list box? i.e. The value would be different on a computer with large fonts as opposed to one with small fonts.
Thanks.
BV6 List Box Multiple Lines
Ok,
I'm trying to get some multiple lines working in a list box.
Like you can do in a text box, if the data imputted into the feild is longer that the width of the text box then it would carry onto the next line.
How do you do this on a list box. On a text box there is a option that is 'multiple line' and you just go true.
Also the 2 lines have to be connected as one, e.g. when you select either of the lines it is highlited as one option.
Any ideas.
Blank Lines In A List Box
Code:
List1.RowSource = "SELECT field1, field2 FROM table1, table2 WHERE table1.record_ID = table2.record_ID"
Question:
Is there a way to insert blank lines between records pulled out by an SQL statement so it'll look like this:
Record 1
Record 2
Record 3
and not
Record1
Record2
Record3
Thanks
Splitting Up Lines From A List
sup guys.
what is the best way to split up a list in order from 1,2,3 e.g
say i have 2 list box's and one of them has info in it like this
1Tester
3Booo
2Yehaha
3jesus
1Freedom
2Grape
and i click a button and it sorts them out in anouther list in "1,2,3" order ?
thanks guys.
List Has Blank Lines
I read a string file and load it into a list box. The list box skips 2 lines on each line listed.
I save file here
Code:
Public Sub Generate_prj()
Open "c:Orlandorobotics_SSCdefault.orp" For Append As #1
Print #1, "Sample1.ors", "Sample2.ors", "Sample3.ors", "Sample4.ors", "Sample5.ors", "Sample6.ors"
Close #1
End Sub
When I read the file and add items to list
Code:
If intFile = 1 Then
Open SelectedFile For Input As #1
intLinesReadCount = 0
Do While Not EOF(1) 'Loasd entire File into LineData String
Line Input #1, strBuffer
LineData(intLinesReadCount) = strBuffer
intLinesReadCount = intLinesReadCount + 1
Loop
Close #1
End If
ComboFileSelect.Clear
DataS = LineData(0)
arrValues = Split(DataS, " ")
For I = 0 To 5
ComboFileSelect.AddItem arrValues(I)
Next I
Multiple Lines (list)
How do I input multiple lines in the list at one time? Like having a list but something generating mutliple linesmust like this :
Line 1
Line 2
Line 3
......... so on......
Well, later!
Edited by - SourceCode on 3/19/2006 4:18:25 PM
Moving Mouse Over The List Box
Hi, I am trying to manually make my own Menu Editor. I don't like how you cannot edit the font and color of the regular menu editor.I got it all working and looking great, but there are 2 small problems that I cannot figure out how to fix.
I want to be able to move the mouse over a list box, and just like a regular menu I want the one that is under the mouse to be highlighted. And as you move the mouse over different selections it will highlight them, without yet clicking on the mouse, anyone know how to do that?
Also, does anyone know how to change the forecolor of a command button? It is possible?
I appreciate any help.
Thanks,
Dan
Moving Items To The End Of The List!
hi!all!
i am looking for a code to move a selected item to the end of the list box!
for example i have a list1 with items
1
2
3
i select the first item ,item 1 and then click the button!
the item should move to the end of the list and the list would look like>
2
3
1
---------------------------
Moving Items Up And Down In A List Box...
Hey guys, I was wondering if anyone can help me on how to move items up and down a list box? Also, if I want to move an item start from the bottom to the top?
Please, help me...
Moving Items Around A List Box
hi !
I have yet another short query here..and would be grateful if anyone could help.
I got a list box with a playlist for a radio show..and to the right of it i have 2 more listboxes..one with duration of track and the other with the point in time at which the track starts in the show.
I have 2 buttons below up and down which when clicked on move the selected item up or down in the playlist accordingly along with the related times.
How do i do this ?
Also how do make sure that there is one item selected at aLL times.
any help would be great !
Harpooon
Moving Up && Down In File List Box
heyy guyz..
i was wondering...if i have a file list box with many files in it...how can i cause the cursor or watever to move to the next file down or up, to the beginning, and to the end of the list of files (and if possible cause the cursor to move randomly as well)...
and if it does move...under which event would that be?? example: file1_change??
thanxx in advance
Moving All Items From One List Box To Another
I am having problems selecting the first item in the list box. Here is the code that I have written:
Private Sub ZonesAll_Click()
Dim ZoneName As String
Dim ZoneNumber As Integer
Dim n As Integer
Dim i As Integer
n = Me.ZonesNotSelected.ListCount
'I need a line here that will select the top item in the list
For i = 0 To n - 1
Me.ZonesNotSelected.Selected
ZoneName = Me.ZonesNotSelected.Text
ZoneNumber = Me.ZonesNotSelected.ListIndex
Me.ZonesNotSelected.RemoveItem ZoneNumber
Me.ZonesSelected.AddItem ZoneName
Next i
End Sub
Thanks
SLR
Moving List Items Up And Down
This is a bit foolish question bu I forgot how to do it.
I want to move items listed in the list box up or down. How do I do it?
Kinjal
Moving Items Up/Down In List Box W/VB
There is another thread in the javascript section with almost the same title, so what I am wondering is if there is a VB version of it. The thread id is
URL
Any help would be greatly appreciated
Moving List (TreeView VB6)
Hey,
I have a list, and I was wondering if there was a way to move an item e.g. from 3 > 4 or 4 < 3 by clicking on a command button? Also if you can drag and drop them to the position that you want them to be in?
Thank You
Moving A Item In A List Box Up Or Down
I have two buttons on a form and I want the be able to click the up button then move the selected item up or click the down button and have the item go down.
Any Ideas?
Sort Item In A List BOx Of 300 Lines Or More
Hi I need help to sort the following in a List Box :
I am reading four variables, such as Date, Time, Name and Phone-number and saving these in a text file sequentially. I laos append a text 'Date', 'Time' etc repectively on each line for identification. So in one loop I add four text line for these four records.
Then I open the file which has already these type of records in the same order starting with identification of Date, Time etc. I identify these by 'InStr' command and then save these to variables, Date, Time, Name and Number to display in a list box as
'AddItem ListBox1 Name & vbTab & Number & vbTab & Date & vbTab & Time
So this displays the LIst BOx in order that my last read Input is read as last item in List BOx. My quetsion now is first how to display in a revers order. The problem is that when I use
While EOF(1)
Redim Preserve Array(k)
Line Input#1.
.
.
It always read the first line. Is there any way to read the last line first or any other way to display in reverse odrer
My second question is probably tough that how to do sorting now. Is it possible if I can sort the Item w.r.t. Name(alphabetically) or Date(numerically). I tried sorting but It always see the first charactrer in the ItemData and sort it that way. Just to remind that all the four data are added to same Item in List BOx. What sorting mechanism will be suitable for a size of Items of 300 lines or so in List Box.
I have spend more than a week and got help from some Forum posts and but now I think I am lost in woods. Please help me.
Thanks.
Ned
Color Particular Text Lines In List Box
I want to color some of the text items in my list box. Does anyone know how to do that? I want some of the entries to be red denoting the items classification.
Thanks,
Tracy
Moving Item Between List Boxes
I have a command button with the Caption ">". When clicked I want the selection the user has made in ListBox1 to be moved to ListBox2.
Anyone ever do something like this before?
thx..
Moving Through The Files In A File List Box...
Hey everyone,
As the title states I am trying to move through files in a file list box. For example...if the file list box contains 3 files and the user selects all 3 and clicks on a delete button, a loop will be activated like below that will update the selected index and call the delete confirmation each time. The problem is I don't know how to get the selected index to change. I have tried filelistbox1.selectedindex.equals(count) but the selected index never changes from 0. If this isn't clear post back and I'll try to explain it better...any help would be greatly appreciated. Thanks in advance
Code:Dim count As Integer = 0
Do Until count = FileListBox1.SelectedItems.Count
'update selected index so when frmdelete is called it uses the right filename
frmdelete.show
count = count + 1
Loop
Edited by - piles on 6/20/2007 8:10:01 AM
Moving Data Between List Boxes
Hi,
I need a little help if anyone has a moment. I have 2 list boxes one called lstSource and the other is lstDestination. I have it set up and working so that I can multi select rows in my source and move them into my value list in my destination list box. I call the function in the click even of a right arrow button. This works great.
Now I want the user to be able to remove fields from the lstDestination in case they make a mistake or change their mind. I want to do this using a left arrow button but I can't quite get the code working properly. I have gotten it to do everything butx but....however, I can't get it to just delete the selected row(s). Here is my code that is working to move my rows from my lstSource to my lstDestination. I assume it must be some variation of this....
<vb code>
Private Sub cmdCopyItem_Click()
CopySelected Me
End Sub
Function CopySelected(frm As Form) As Integer
Dim ctlSource As Control
Dim ctlDest As Control
Dim strItems As String
Dim intCurrentRow As Integer
Set ctlSource = frm!lstSource
Set ctlDest = frm!lstDestination
For intCurrentRow = 0 To ctlSource.ListCount - 1
If ctlSource.Selected(intCurrentRow) Then
strItems = strItems & ctlSource.Column(0, _
intCurrentRow) & ";"
End If
Next intCurrentRow
' Reset destination control's RowSource property.
ctlDest.RowSource = ""
ctlDest.RowSource = strItems
End Function
</vb code>
[VB6] Open TXT File (the Text Lines) Into The List?
Hello, how do i make a button, that when i click the buttoon, then i must choose what txt file i want to put in the listbox, then when i have choose it
all the text lines going to the list! How to make it!?
And how to make a button that delete all the strings/texts in the list?
Adding Colour To Individual Lines In A List Box
Is this posible. I have a list box which holds exense data. So for credits into the list box i want them green and for debits I want them red. I have tried using the .forecolor propety but that just changes the entire forecolor of the list box, I have tried searching but didnt really find anything.
can any one help
Cheers
Chris
Display Lines Between Items In A List/combo/listview
I want to display the contents of a field in my table in the format shown in the attachment.
could anyone suggest me how to get the same visual. I have tried with datalist, combobox, list view and list box
But, I couldn't get the lines between two records. Any suggestions and guidance is greatly
appreciated.
thanks in advance
Kalpana
Delete Blank Lines In A List Box...problems With Code
I have a listbox that is reading information from a text file, I have some code that is not working. It is suppose to be deleteing all of the blank lines that are in a listbox, that come from a textbox. I was wondering if someone could tell me what is wrong with this code? Thanks
Code:
'clears out all of the blank spaces that might be associated with the file
For I = lstCapSearch.ListCount - 1 To 0 Step -1
If lstCapSearch.List(I) = "" Then
lstCapSearch.RemoveItem I
End If
Next I
Open "C:Captains.txt" For Append As 1
Close 1
'adds the information to the listbox
Dim sTemp As String
lstCapSearch.Clear
'opens the text file and puts the information inside the listbox
Open "C:Captains.txt" For Input As #1
While Not EOF(1)
Line Input #1, sTemp
lstCapSearch.AddItem sTemp
Wend
'clears out all of the blank spaces that might be associated with the file
For I = lstCapSearch.ListCount - 1 To 0 Step -1
If SendMessageString(lstCapSearch.hwnd, LB_FINDSTRINGEXACT, -1, ByVal lstCapSearch.List(I)) <> I Then
lstCapSearch.RemoveItem I
End If
Next I
Close #1
Searching For And Moving E-mails In An Outlook PST From A List In Excel Using VBA
Hi there,
I was hoping someone might be able to give me some guidance - I have the task of sorting various e-mails in a master PST, into seperate folders based on a list of e-mail addresses which have been extracted from the PST, and are stored as a simple Excel workbook.
the current list of addresses reaches around 5000 items, and so doing this manually would be a extremely burdensom task - I was hoping that this would made fairly simple by the use of a VBA marco, and it could be easily recorded however Outlook does not allow the recording of macros. I've also been reviewing various samples, but cannot make head nor tail of what needs to be done, and my experience with VBA is fairly limited.
Basically what needs to happen is:
- vba selects the e-mail address from a cell in Excel, and copies this value
- changes to Outlook, and performs a search on the Inbox for the copied value (e-mail adress) as the sender, and then moves any e-mail item found with this value to a seperate folder
- goes back to Excel, and repeats the process to select the next cell's value.
If anyone would be able to help or provide some guidance or sample code, it would be greatly appreciated!
Best regards,
Nick
Code For Moving To The First Blank Cell In A Worksheet; Moving Left,right,up Or Down
I have created an application form as a userform in Excel. I need to send the data entered into my text boxes when the program runs to separate excel cells in a worksheet.
My problem is I can use code that will send the textbox entry to a specific cell eg. If my textbox is named Surname I can say
range("a5").value = surname but if I do that when I run the programme to enter the next record for someone else the first record will be overwritten.
I NEED A CODE LINE THAT WILL TAKE ME TO THE FIRST EMPTY CELL AND ALLOW ME TO MOVE DOWN OR TO THE LEFT OR TO THE RIGHT
Reading Certain Lines Of Files And Outputting Those Lines
This is what I am trying to do and I think I am going about it all wrong.
I am trying to read a log file (ascii) and only want to read in certain pieces of information (e.g. a failed request for a web page) and then I want that information written to a new file.
I wont even attempt to post thw code I have trying to work with, if someone can give me some pointers of post some example, I would really appreciate it.
Hmm - New Lines Arent Read As New Lines By Vb In A File
Heres the situation
im using urldownloadtofile to download a text file from the internet onto the harddrive. although the textfile on the net has 5 items, each on a single line, when i use that function the file saves as 5 items all on a single line.. and where a new line is supposed to be, i see a "box" in notepad..
needless to say, when i try to load the file into an array using Line Input, all 5 items are on a single array number, instead of one item in each array number..
heres what i mean..
text file online:
a
b
c
d
e
text file when downloaded to hd:
a[]b[]c[]d[]e
the box is interesting, if i copy the entire text from the file on my hd and paste it, they paste with all 5 items on seperate lines..
my question is, how can i load a[]b[]c[]d[]e with one item in each array with VB? line input wont work cause itll store a[]b[]c[]d[]e in one string
Read Lines And Count Lines From Txt File - Thank Ye All
hello again
im back for some more help, so i hope you guys can.
ive had a quick search on the forums for this but cant find anything that helps, so heres my problem:
i have this code:
Code:
Function random2()
Dim lines As Integer
Dim current As String
lines = 0
Open "C:files.txt" For Append As #1
Do While Not EOF(1)
Line Input #1, current
lines = lines + 1
MsgBox (current)
Loop
Close #1
txtFILE = lines
End Function
but that code doesnt work, it does count the lines at all, i get no msgbox's, no count, no nothing.
any help would be much appreciated.
thanks.
Primary_Slave
----------------------------------------------------------------------------------------
I'm all wrapped up in my binary blanket and I'm coding on late into the night
----------------------------------------------------------------------------------------
Edited by - Primary_Slave on 11/4/2004 9:46:42 AM
Moving Balls To Moving Images??
Please take a look at this as it is related to my question
Thread
is it possible for the create images to be an image type that is already drawn?
How Many "visible" Lines (including Wrapped Lines) Are In A RTB?
I know I can get the "total" number of lines (including wrapped lines) in a RichTextBox by doing the following:
Code:SendMessage(RichTextBox1.hwnd, EM_GETLINECOUNT, 0&, ByVal 0&)
but, how can I get the total number of "visible" lines (including wrapped lines) in a RichTextBox only (ie: only the lines currently able to be seen in a RTB)?
Edited by - uncletr on 1/16/2007 5:27:03 AM
Lines Events Lines Ocx
I would like to create lines with vb6 and to change them when my program is runnig, but "line1" doesn't have any events, not mouse_clickmouseover.
I'm looking for solution for that problem or lines ocx instead.
Hope for answers...
Help With File List , Dir List And Drive List Boxes..
How do i link my drive list , file list and dir list boxes to gether , so that when i for exaple set the drive list to c: , the dir list will then give all dir in there, and file list will show me files from the directory, right now the default file list is set to my vb file list and i cant change it...
Getting A Combo Box List And Putting It In A List Box List On Another Form
I am finally writing my first MDI! I'm doing a lot better than I thought I would so far, but now I'm stuck. I need to have a list from a combo box copied into a list box on another form. I want it in the Form_Load() event. Right now I have:
Code:Private Sub Form_Load()
frmpresetedit.deletepreset.List = frmtimer1.cmbpresets.List
frmpresetedit.Show
End Sub
deletepreset is the list box, cmbpresets is my combo box.
It always comes up with a compile error at the .list part of cmbpresets.list and says that 'the argument is not optional'. What is my problem here? I'm sure this problem is simple and I'm probably just making a stupid mistake. What code do I need to use?
Thanks
Now, don't get me wrong, 'cause baseball's a great sport.
It teaches little children simple eye-hand coordination with little effort or exhaustion.
-byufan
Edited by - byufan on 7/20/2004 4:20:57 PM
Select Folder Dialog. List All Folders And Subfolder In List View
Hello all.
I am trying to select a folder in a folder dialog. I then want it to list all the folders and subfolders and files within the selected folder in the list view.
this is what i have so far. It just lists all the first children folders of the selected folder. any help on this?
Code:
Private Sub addFolders()
FolderBrowserDialog.ShowDialog()
ListView1.Items.Add(FolderBrowserDialog.SelectedPath) 'lists top selected folder
Dim STF As New IO.DirectoryInfo(FolderBrowserDialog.SelectedPath)
Dim F As IO.DirectoryInfo
'lists each folder inside top folder
For Each F In STF.GetDirectories()
ListView1.Items.Add(F.Name)
Next
End Sub
|