
BlueOysterCult
Avatar/Signature-
Posts
87 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by BlueOysterCult
-
Help?! with SQL statment -OleDbDataAdapter1
BlueOysterCult replied to BlueOysterCult's topic in Database / XML / Reporting
Hey Mehyar! What I want is the user to put in a range ie 1980 - 1987 and my datagrid to reflect that request with year descending R -
I hope I am in the right forum Hello, I have a cd collection program that has a datagrid that I have filters on it such as sort by title or artist and I have one that is sort(filter) by Year. I am using an input box to get the users request every filter except the year is working - I can't get it to filter - can someone help? Dim strSQL, strYear As String strYear = InputBox("Please enter a year to search" & vbNewLine & "Example: 1995") strSQL = "select CdArtist,CdTitle, CdYear,CdKey,CdCategory from Cds where CdYear between 1975 and 1995 " 'Here is the problem- what do I put in place of 1975 and 1995? OleDbSelectCommand1.CommandText = strSQL DbCdCollection1.Clear() OleDbDataAdapter1.Fill(DbCdCollection1) UpdateCounter() thanks Rob
-
Double has something to do with a 64 bit floating point Pi as Double is 3.1415926535 I think maybe use Single?
-
Public Sub LoadCDArray() Dim intCdCount As Integer 'Read file into array Do Until EOF(gintCdFileNum) If intCdCount + 1 = Int(intCdCount + 1) Then ReDim Preserve CdArray(intCdCount + 1) End If ' Load the data in a loop with fields 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) End Sub Structure CdType Dim strArtist As String Dim strTitle As String Dim strYear As String Dim strCategory As String End Structure R
-
For i = 0 To CdArray.GetUpperBound(0) R
-
Hello again my fellow Net forum users I am wrestling with this Find Function and button. I am getting a Null Refernce error - I have tried every combination of things to no avail. I should point out that in the Autos tab I am getting a value (the artist I put in the FindBox.text) but it is red(?) Function: Public Function FindArtist(ByVal strArtistToFind As String) As Integer Dim i As New Integer 'Dim ArtistIndex As Integer 'loop through the array For i = 0 To CdArray.GetUpperBound(0) If CdArray(i).strArtist = strArtistToFind Then 'we found the artist, return this index Return i End If Next 'once this code is executed we know we didn't find an artist Return -1 End Function the button: Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click Dim index As Integer = FindArtist(txtFindBox.Text) If index <> -1 Then txtArtist.Text = CdArray(index).strArtist txtTitle.Text = CdArray(index).strTitle txtYear.Text = CdArray(index).strYear txtCategory.Text = CdArray(index).strCategory Else MessageBox.Show("Artist not Found") End If End Sub Thanks Rob
-
Hey Mehyar I am getting a null reference in the function - its pointing at for i = 0 to CdArray.length - 1 line Public Function FindArtist(ByVal strArtistToFind As String) As Integer Dim i As Integer Dim ArtistIndex As Integer 'loop through the array For i = 0 To CdArray.Length - 1 If CdArray(ArtistIndex).strArtist = strArtistToFind Then 'we found the artist, return this index Return i End If Next 'once this code is executed we know we didn't find an artist Return -1 End Function uggg. why is this happening? Rob
-
I have been doing a lot of copying and pasting.... I am tired of this project..... thanks for your help.. my find button is as follows Private Sub mnuActionFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles mnuActionFind.Click, btnFindArtist.Click Dim index As Integer = FindArtist(txtFindBox.Text) If index <> -1 Then txtArtist.Text = CdArray(intCurrent).strArtist txtTitle.Text = CdArray(intCurrent).strTitle txtYear.Text = CdArray(intCurrent).strYear txtCategory.Text = CdArray(intCurrent).strCategory Else MessageBox.Show("Artist not Found") End If I see now that it has been repeated Thanks Mehyar I really appreciate it Rob
-
I get a stack overflow error in the following code: Help? What is the problem here? Public Function FindArtist(ByVal strArtistToFind As String) As Integer Dim ArtistIndex As Integer = FindArtist(txtFindBox.Text) >>>>> HERE is the problem<<<<< Dim i As Integer 'loop through the array For i = 0 To CdArray.Length - 1 If CdArray(ArtistIndex).strArtist = strArtistToFind Then 'we found the artist, return this index Return i End If Next 'once this code is executed we know we didn't find an artist Return -1 End Function Thanks Rob hi Mehyar
-
I have tried every combination of this and I am still getting the parameter error Public Function FindArtist(ByVal strArtistToFind As String) As Integer Dim ArtistIndex As Integer = FindArtist(txtArtist.Text) Dim i As Integer 'loop through the array For i = 0 To CdArray.Length - 1 If CdArray(ArtistIndex).strArtist = strArtistToFind Then 'we found the artist, return this index Return i End If Next 'once this code is executed we know we didn't find an artist Return -1 End Function End Class Rob ;-(
-
Uggggg yes - it is txtArtist.text See it was so easy it was hard Thank you for your help!! R
-
Private Sub mnuActionFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuActionFind.Click FindArtist() End Sub If I dim ArtistIndex as int = findArtist("jonh lennon") How does that give the user a way to put in the search? R why is this confusing to me?
-
Thank you Mehyar When I call the function in the Form I have an error that says "Argument not specified for parameter strArtistToFind" I had that before and it is reffering to the (ByVal strArtistToFind As String) (?) Rob
-
Uggg Been working on this Find/Search for a while.... I feel like I am closer but then again.. CAN someone help? Public Function FindArtist(ByVal strArtistToFind As String, ByRef intCurrent As Integer) As Integer Dim strFindWhat As Boolean Dim intSearch As Integer intSearch = intCurrent strFindWhat = False Do Until strFindWhat = True If CdArray(intSearch).strArtist Then strFindWhat = True End If Loop Else MsgBox("The data you are searching for does not exist") I know its rough but thsi searching thing is hard Rob
-
Yes it does help thanks my array loos like this Public Sub LoadCDArray() Dim intCdCount As Integer 'Read file into array Do Until EOF(gintCdFileNum) If intCdCount + 1 = Int(intCdCount + 1) Then ReDim Preserve CdArray(intCdCount + 1) End If ' Load the data in a loop with fields 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) End Sub I aske d a frien about the first line in the Find func - he said soemthing about the params being - byval ... and byref .... what would be the SearchCriteria? "," ? Rob
-
Hello again all If I have asked this question already - I am sorry I can't remember if I did or not I would like to add a "search/find artist" (file in the array) to my CD Collection program- I am not sure even where to start - some sort of .Subtring? That's all my brain can come up with. Maybe a boolean type thing? I don't know- Can anyone give me any ideas? All I have so far of course is: Public Function FindArtist() As Integer Rob
-
Yeah thanks I just swithed things around and not a bit of difference Thanks! R
-
Hello all I hope everyone had a great Thanksgiving I was wondering if the order of my subs matters... i.e. "Open" after "UpdateForm"? R
-
thanks Private Sub MoveNext(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles mnuActionNext.Click, btnNext.Click If Not intCurrent = UBound(CdArray) Then intCurrent += 1 End If UpdateFormData() End Sub Private Sub MovePrevious(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles mnuActionPrevious.Click, btnPrevious.Click If Not intCurrent = UBound(CdArray) Then intCurrent -= 1 End If UpdateFormData() End Sub GetNextRecord: 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 LoadCDArray is after the next and previous - is the oder the problem? R
-
Man, I am sorry to take up so much of your time... nothing is happening still I am not going to the next record with the "next "button - but no errors that's a plus R
-
Do I put it right underneath it in the Module? It is appearing outside the "body" and won't let me put it right underneath R
-
It s not doing anything.. but no error The array needs to be dynamic doesn't "0" ruin that/ R
-
Oh I'll try that Thanks I'll let you know R
-
I don't know - is trhis what you mean? Like this? This is in my module: Structure CdType Dim strArtist As String Dim strTitle As String Dim strYear As String Dim strCategory As String End Structure Public CdArray() As CdType #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 Yes I do have option strict on Rob
-
Thanks for your reply Actually the Debugger is landing on the "Next" (and I assuming it will on the "Previous" button if it could get that far) button that calls the array Private Sub MovePrevious(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles mnuActionPrevious.Click, btnPrevious.Click If Not intCurrent = UBound(CdArray) Then intCurrent -= 1 End If UpdateFormData() End Sub It says UBound(CDArray) (that line anyway) = nothing or array can't be null or something Thanks ROb