Jump to content
Xtreme .Net Talk

BlueOysterCult

Avatar/Signature
  • Posts

    87
  • Joined

  • Last visited

Everything posted by BlueOysterCult

  1. Hello All The problem may lie elsewhere but I believe the array is not being filled - I get a �value cannot be null� error when I hit the "next" but on my form - the (obvious) next record to be displayed Can someone see something? Private Sub LoadCDArray() Dim intCDCount As Integer ' Open the file Do Until EOF(gintCdFileNum) If intCDCount / 10 = Int(intCDCount / 10) Then ReDim Preserve CdArray(intCDCount + 10) End If ' Load the data in a loop Input(gintCdFileNum, CdArray(intCDCount).strArtist) Input(gintCdFileNum, CdArray(intCDCount).strTitle) Input(gintCdFileNum, CdArray(intCDCount).strYear) Input(gintCdFileNum, CdArray(intCDCount).strCategory) intCDCount += 1 Loop ReDim Preserve CdArray(intCDCount - 1) '' Close the file 'FileClose(gintCdFileNum) End Sub End Class Thanks Rob
  2. I am to 'UpdateFormData' -(fill in textboxes) with the next record in the file and reverse with the previous button Is that what you mean? R
  3. Hello all I have a project that has a "next" button and a "previous" button. I am having troble with both of them - For hte next button its the array values: If Not EOF(gintCdFileNum) Then Input(gintCdFileNum, gstrArtist) Input(gintCdFileNum, gstrTitle) Input(gintCdFileNum, gshtYear) Input(gintCdFileNum, gstrCategory) If (intCurrent + 1) <= intLast Then intCurrent += 1 CdArray().Artist() CdArray(intCurrent).Title() CdArray(intCurrent).Artist() CdArray(intCurrent).Artist() 'What to put for the values here (after.Artist etc) Else intCurrent = 0 End If End If and the previuos button is worse - I am supposed to do the opposite of course put I am getting some kind of method nt exprersion error [code] Private Sub MovePrevious(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles mnuActionPrevious.Click, btnPrevious.Click If (intCurrent <= 1) >= intLast Then intCurrent <= 1 CdArray(intCurrent).Artist() End If Can anyone help me? I have looked at it for so long I am not seeing what I am doing Rob
  4. I fdidn't know I was over posting - I don't know where the problem is coming from sorry This can be marked as done - I won't be doing this project for a while R
  5. Yes - that's what I am looking for... Any idea how to have the rest of the line "fill in" as the user is typing it? R
  6. Hi everyone I have a project that is a CD collection. The user can open a file and display a list of CDs hitting the "next" button. I thought it would be cool if a Find feature was there.. So the user could type in a partial letters of there fav band and it would fill in the rest if it were there. I don't even know where to start... its a dynamic array etc etc.. Does VB.NET have a good feature for this ROb
  7. Thanks for the reply Actually he is THE best teacher I have ever had and I have been doing this stuff (VB UNIX SQL etc ) for a while now. I will try the Open.Text etc Thanks Rob
  8. PArt of the assignmnet is to have a dialog "open File" box pop up to choose from a list of files... can it be done with StreamReader? R
  9. I did though.. do the streamreader thing and had it go to a msgBox so I can see if it could read the file and it did work R
  10. MY teacher is not keen on the StreamReader idea. We should be using the FileOPen stuff -
  11. Thanks The idea here is that I need to have the user open a file from a list of files (Cds - for cd collections) and then once clicked it displays the first file from that collection here is the cose from the Module Region "Global Variables" ' For Cd data from file Public gstrArtist As String, gstrTitle As String, gshtYear As Short, gstrCategory As String ' For file number and file name Public gintCdFileNum As Integer = -999 ' -999 means "no file is open" Public gstrCdFileName As String = "CdCollection.cds" Public CdArray() As CdType #End Region #Region "Utility Procedures (non-UI)" Public Sub OpenFile() ' Get an available file number, store it in the global variable, and open the file. gintCdFileNum = FreeFile() FileOpen(gintCdFileNum, gstrCdFileName, OpenMode.Input) End Sub Public Sub GetNextRecord() ' Get the next record, but only if we aren't already at the end of the file If Not EOF(gintCdFileNum) Then Input(gintCdFileNum, gstrArtist) Input(gintCdFileNum, gstrTitle) Input(gintCdFileNum, gshtYear) Input(gintCdFileNum, gstrCategory) End If End Sub Public Sub CloseFile() ' Close the file and set the file number to an invalid value (so we aren't ' tempted to try to use it again) If gintCdFileNum <> -999 Then FileClose(gintCdFileNum) gintCdFileNum = -999 End If End Sub Public Sub MoveToStartOfFile() ' Close and open the file--easiest way to get the pointer back to the start! CloseFile() OpenFile() End Sub Structure CdType Dim Artist As String Dim Title As String Dim Year As Short Dim Category As String End Structure #End Region End Module and here is the code for the UI Private Sub ToggleUIItems() ' Switch items to opposite enabling from present state. This happens when we move ' back and forth from a state of a file being open to a file not being open. ' Note that the File Exit command is always available, so we don't toggle it. ' Also note that we are toggling the Previous items, even though they aren't ' implemented in the first version. ' File menu mnuFileOpen.Enabled = Not mnuFileOpen.Enabled mnuFileClose.Enabled = Not mnuFileClose.Enabled ' Action menu mnuActionNext.Enabled = Not mnuActionNext.Enabled mnuActionPrevious.Enabled = Not mnuActionPrevious.Enabled mnuActionGoToStart.Enabled = Not mnuActionGoToStart.Enabled mnuActionFind.Enabled = Not mnuActionFind.Enabled ' Buttons btnNext.Enabled = Not btnNext.Enabled btnPrevious.Enabled = Not btnPrevious.Enabled End Sub Private Sub SetFormCaption(ByVal strFileName As String) ' Set form caption, if provided. If empty, set to default name. If strFileName = "" Then Me.Text = "CD Collection" Else Me.Text = strFileName & " - CD Collection" End If End Sub Private Sub UpdateFormData() ' Set form data based on globals txtArtist.Text = gstrArtist txtTitle.Text = gstrTitle txtYear.Text = gshtYear.ToString txtCategory.Text = gstrCategory End Sub Private Sub mnuFileOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles mnuFileOpen.Click Dim openFileDialog1 As New OpenFileDialog Dim LineofText As String openFileDialog1.InitialDirectory = "C:\Documents and Settings\Rob\School\CIS 172\cdCollection\bin\" openFileDialog1.Filter = "CD files (*.CDS)|*.CDS|All files (*.*)|*.*" ' Display an OpenFileDialog so the user can select a file. openFileDialog1.Filter = "CD Files|*.cds" openFileDialog1.Title = "Select a Cd File" ' Show the Dialog. If openFileDialog1.ShowDialog() = DialogResult.OK Then If openFileDialog1.FileName <> "" Then Do Until EOF(1) Loop 'Me.Cursor = New Cursor(openFileDialog1.OpenFile()) End If End If 'If openFileDialog1.FileName <> "" Then ' Try ' Do Until EOF(1) ' LineofText = CdArray() ' Loop ' Catch ' MsgBox("Error opening file") ' End Try 'End If openFileDialog1.FilterIndex = 2 openFileDialog1.RestoreDirectory = True ToggleUIItems() SetFormCaption(gstrArtist) 'GetNextRecord() UpdateFormData() End Sub Private Sub mnuFileClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles mnuFileClose.Click ToggleUIItems() SetFormCaption("") 'CloseFile() ' Blank out the global CD data & update the UI gstrArtist = "" gstrTitle = "" gshtYear = 0 gstrCategory = "" UpdateFormData() End Sub Private Sub mnuFileExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileExit.Click 'CloseFile() End End Sub Private Sub mnuActionFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles mnuActionFind.Click MessageBox.Show("Not yet implemented", "Work in Progress", MessageBoxButtons.OK, _ MessageBoxIcon.Information) End Sub Private Sub MoveNext(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles mnuActionNext.Click, btnNext.Click 'GetNextRecord() UpdateFormData() End Sub Private Sub MovePrevious(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles mnuActionPrevious.Click, btnPrevious.Click MessageBox.Show("Not yet implemented", "Work in Progress", MessageBoxButtons.OK, _ MessageBoxIcon.Information) End Sub Private Sub mnuActionGoToStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuActionGoToStart.Click 'MoveToStartOfFile() 'GetNextRecord() UpdateFormData() End Sub End Class Do I still need to EOF the file - how do I get it to display the first collection? THanks a bunch Rob
  12. I guess I am not understanding what the cursor is or what it does. I commented out the line and it didn't blow up. But now I am trying to read in an array - a do until EOF in there -which I am not getting to work R
  13. I am having the only able to pick CDS files do I change Cursor to CDS? Should I just take that line out? cute kids btw R
  14. Hello All I was able to get a FileOPenDialog to work but when I pick a file I get an error that lands on Me.Cursor - I don't know why I have it there. I think I picked it accidently but now I don't want it?) any ideas what I need to put there? here's my code Dim openFileDialog1 As New OpenFileDialog openFileDialog1.InitialDirectory = "C:\Documents and Settings\Rob\School\CIS 172\cdCollection\bin\" openFileDialog1.Filter = "CD files (*.CDS)|*.CDS|All files (*.*)|*.*" ' Display an OpenFileDialog so the user can select a file. openFileDialog1.Filter = "CD Files|*.cds" openFileDialog1.Title = "Select a Cd File" ' Show the Dialog. If openFileDialog1.ShowDialog() = DialogResult.OK Then If openFileDialog1.FileName <> "" Then Me.Cursor = New Cursor(openFileDialog1.OpenFile()) End If End If Thanks Rob
  15. Hello All, I have this project. "a CD Collection" - the user can go through a long list of CDs. I am having a problem with my database - connecting to it I should say. the error is "C:\DBs\CDColl.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server om shich the file resides." One, how do I make sure the path is correct? I had it working at school but I am trying to work on it at home. Two, the file does not reside on the server. I lost my database I think? I am lost.... here's my code - 'Option Strict On Public Class frmCdCollection Inherits System.Windows.Forms.Form 'Private Sub GetNextRecord() ' BindingContext(DbCdCollection1, "Cds").Position += 1 'End Sub Private Sub UpdateCounter() Dim intCount, intCurrent As Integer intCurrent = BindingContext(DbCdCollection1, "Cds").Position + 1 intCount = BindingContext(DbCdCollection1, "Cds").Count 'lblRecord.Text = intCurrent.ToString & "/" & intCount.ToString End Sub Private Sub frmCdCollection_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DbCdCollection1.Clear() OleDbDataAdapter1.Fill(DbCdCollection1) 'HERE IS WHERE THE DEBUGGER HIGHLIGHTS THE ERROR with the path error UpdateCounter() End Sub Private Sub MoveNext(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuMoveNext.Click, btnNext.Click BindingContext(DbCdCollection1, "Cds").Position += 1 UpdateCounter() End Sub Private Sub MovePrevious(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles mnuMovePrevious.Click, btnPrevious.Click BindingContext(DbCdCollection1, "Cds").Position -= 1 UpdateCounter() End Sub Private Sub MoveFirst(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles mnuMoveFirst.Click, btnFirst.Click BindingContext(DbCdCollection1, "Cds").Position = 0 UpdateCounter() End Sub Private Sub MoveLast(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles mnuMoveLast.Click, btnLast.Click BindingContext(DbCdCollection1, "Cds").Position = BindingContext(DbCdCollection1, "Cds").Count - 1 UpdateCounter() End Sub Private Sub mnuShowAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuShowAll.Click OleDbSelectCommand1.CommandText = _ "select * from Cds" DbCdCollection1.Clear() OleDbDataAdapter1.Fill(DbCdCollection1) UpdateCounter() End Sub Private Sub mnuByArtist_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuByArtist.Click Dim strArtist As String, strSQL As String strArtist = txtArtist.Text strSQL = "select CdArtist,CdTitle, CdYear,CdKey,CdCategory from Cds where CdArtist like '%" & strArtist & "%'" OleDbSelectCommand1.CommandText = strSQL DbCdCollection1.Clear() OleDbDataAdapter1.Fill(DbCdCollection1) UpdateCounter() End Sub Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click End End Sub Private Sub mnuByTitle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuByTitle.Click Dim strTitle As String, strSQL As String strTitle = txtTitle.Text strSQL = "select CdArtist,CdTitle, CdYear,CdKey,CdCategory from Cds where CdTitle like '" & strTitle & "%'" OleDbSelectCommand1.CommandText = strSQL DbCdCollection1.Clear() OleDbDataAdapter1.Fill(DbCdCollection1) UpdateCounter() End Sub Private Sub mnuByYear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuByYear.Click Dim strSQL As String strSQL = "select CdArtist,CdTitle, CdYear,CdKey,CdCategory from Cds where CdYear between 1988 and 1985" OleDbSelectCommand1.CommandText = strSQL DbCdCollection1.Clear() OleDbDataAdapter1.Fill(DbCdCollection1) UpdateCounter() End Sub Private Sub mnuByCategory_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuByCategory.Click Dim strCategory As String, strSQL As String strCategory = txtCategory.Text strSQL = "select CdArtist,CdTitle, CdYear,CdKey,CdCategory from Cds where CdCategory like '%" & strCategory & "%'" OleDbSelectCommand1.CommandText = strSQL DbCdCollection1.Clear() OleDbDataAdapter1.Fill(DbCdCollection1) UpdateCounter() End Sub End Class thanks Rob
  16. Yeah thanks! I used a multi lined textbox with scrollbars Rob
  17. Hello all, I have a "submit" button that I made an image for to make it look cool. The problem is that when I run my program.. it is not there and the word 'submit' which I had original had there is there.. Also my multi line textbox is not multi lined either it is single line.. I rebooted the see if the changes would take effect but nothing... What is going on? HELP Rob
  18. I need to "print" instructions to a label of fixed size after the instructions button is clicked. I have too much text to fit in it.. there isnt a scroll bar for label.. I am not sure how I can do this. any suggetstions? I could I guess use something else - say a textbox - help!? Rob
  19. Hello all, I am making a word guess game. The game gives the user 10 guesses and hints to the next guess. It is becoming a large form and I would like to find a way to "split" the guesses/hints in half.. any ideas? Something like a tab... (I don't know how to make that work though) Rob
  20. Thanks - I don't see how to do that using Visual Studio- I must be looking int he wrong place - is it an import? R
  21. Hello all, I am in charge of making the UI for a project. I would like it to look really cool. My vision is to have some kind of splash screen movie type intro - nothing really huge but just a "wow" type thing. Any ideas how VB.net can do this. I did a help and all I could find is a C#, FoxPro,Media Player stuff. Any help would be great Thanks Rob
  22. I have in a book here: "Usually 16-bits per character - Range: 0 to apprx. 2 billion 16bit Unicode characters" Does that help?
  23. I have the Private Sub Calc - but I am not sure what you mean by the "Validate events of controls" R
  24. Hello All, First, this is not a homework question. Secondly, I was wondering if one could have an app when numbers are entered to automatically (with the help of a comboBox) do the calculation and print to a textBox Rob I think I am going in the wrong direction with "Validating fields" Thanks
  25. thank you Ugggg! Form Load of course - thank you I will try it
×
×
  • Create New...