Jessie
Nov 5th, 1999, 02:05 AM
i new to vb and trying to figure a way to remove the text from the combobox and put it into the flexgrid at the same time but when i select text in the middle of the list box it will transfer to the grid but will not remove the text from the combo box . here's what i have for code this create a error message when i try to add 5 or 6 items to the grid i would like to know how to also store the text from the combo box to a variable
thxs anyone Private Sub Form_Load()
Create_Movie_List
Form_Refresh
End Sub
'loads moviedata to cbomovies
Private Sub Create_Movie_List()
Dim strTemp As String
Dim intCount As Integer
Dim intFreeFile As Integer
Dim intInstr As Integer
intCount = 0
intFreeFile = FreeFile
Open MovieData For Input As #intFreeFile
Do
ReDim Preserve S_TagMovieFile(intCount)
Input #intFreeFile, strTemp
intInstr = InStr(strTemp, "|")
S_TagMovieFile(intCount).strMovieName = Left(strTemp, intInstr - 1)
S_TagMovieFile(intCount).dblPrice = Right(strTemp, Len(strTemp) - (intInstr))
cboMovies.AddItem S_TagMovieFile(intCount).strMovieName
intCount = intCount + 1
Loop Until EOF(intFreeFile)
Close #intFreeFile
End Sub
Private Sub Form_Refresh()
Create_Grid
End Sub
Private Sub cmdAddMovie_Click()
If cboMovies.Text = "" Then Exit Sub
grdMovieselect.Col = 1
grdMovieselect.Row = intMovieCount + 1
grdMovieselect.Text = cboMovies.Text
intMovieCount = intMovieCount + 1
grdMovieselect.Rows = intMovieCount + 2
Fill_Movie_grid
End Sub
Private Sub Create_Grid()
grdMovieselect.Rows = 2
grdMovieselect.Cols = 3
grdMovieselect.ColWidth(0) = 5
grdMovieselect.Row = 0
grdMovieselect.Col = 1
grdMovieselect.ColWidth(1) = 1500
grdMovieselect.Text = " Movie Name"
grdMovieselect.Row = 0
grdMovieselect.Col = 2
grdMovieselect.ColWidth(2) = 700
grdMovieselect.Text = " Cost"
End Sub
Private Sub Fill_Movie_grid()
Dim iIndex As Integer
ReDim S_TagMovieFile(0)
With FormVideo
For iIndex = 0 To intMovieCount - 1
ReDim Preserve S_TagMovieFile(iIndex)
.grdMovieselect.Row = iIndex + 1
.grdMovieselect.Col = 1
S_TagMovieFile(iIndex).strMovieName = .grdMovieselect.Text
cboMovies.Text = cboMovies.RemoveItem(iIndex)
Next iIndex
End With
End Sub
thxs anyone Private Sub Form_Load()
Create_Movie_List
Form_Refresh
End Sub
'loads moviedata to cbomovies
Private Sub Create_Movie_List()
Dim strTemp As String
Dim intCount As Integer
Dim intFreeFile As Integer
Dim intInstr As Integer
intCount = 0
intFreeFile = FreeFile
Open MovieData For Input As #intFreeFile
Do
ReDim Preserve S_TagMovieFile(intCount)
Input #intFreeFile, strTemp
intInstr = InStr(strTemp, "|")
S_TagMovieFile(intCount).strMovieName = Left(strTemp, intInstr - 1)
S_TagMovieFile(intCount).dblPrice = Right(strTemp, Len(strTemp) - (intInstr))
cboMovies.AddItem S_TagMovieFile(intCount).strMovieName
intCount = intCount + 1
Loop Until EOF(intFreeFile)
Close #intFreeFile
End Sub
Private Sub Form_Refresh()
Create_Grid
End Sub
Private Sub cmdAddMovie_Click()
If cboMovies.Text = "" Then Exit Sub
grdMovieselect.Col = 1
grdMovieselect.Row = intMovieCount + 1
grdMovieselect.Text = cboMovies.Text
intMovieCount = intMovieCount + 1
grdMovieselect.Rows = intMovieCount + 2
Fill_Movie_grid
End Sub
Private Sub Create_Grid()
grdMovieselect.Rows = 2
grdMovieselect.Cols = 3
grdMovieselect.ColWidth(0) = 5
grdMovieselect.Row = 0
grdMovieselect.Col = 1
grdMovieselect.ColWidth(1) = 1500
grdMovieselect.Text = " Movie Name"
grdMovieselect.Row = 0
grdMovieselect.Col = 2
grdMovieselect.ColWidth(2) = 700
grdMovieselect.Text = " Cost"
End Sub
Private Sub Fill_Movie_grid()
Dim iIndex As Integer
ReDim S_TagMovieFile(0)
With FormVideo
For iIndex = 0 To intMovieCount - 1
ReDim Preserve S_TagMovieFile(iIndex)
.grdMovieselect.Row = iIndex + 1
.grdMovieselect.Col = 1
S_TagMovieFile(iIndex).strMovieName = .grdMovieselect.Text
cboMovies.Text = cboMovies.RemoveItem(iIndex)
Next iIndex
End With
End Sub