Solved

Visual Basic Assignment. Need help!

Posted on 2013-11-22
6
742 Views
Last Modified: 2013-11-22
Instruction : Woody Real Estate HW5
Outcome : Must be same with HW5 0101-Hellow_World
Visual Basic File : HW5-0101-Jong-Lee

Hi I totally get lost from #11 to #13 (Instruction)
Could you please write down codes for me?
I really need your help as soon as possible!

Thank you!

--From number 11

    Private Funtion SearchFrom(ByVal startIndex As integer,
                    Byval bedroom as Integer,
                    ByVal bathroom As Integer,
                    ByVal proptate As String) As Integer

    Private Sub searchButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles searchButton.Click

    End Sub

    Private Sub searchNextButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles searchNextButton.Click

    End Sub
End Class
Woody-Real-Estate-HW5.docx
HW5-0201-Jong-Lee.vbproj
0
Comment
Question by:John_Lef
  • 3
  • 2
6 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 39668745
Try to do your own homework and come back with exact questions. If we do it all for you, you will never learn!
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 500 total points
ID: 39668819
The instructions are pretty good...what's the problem?

Did you add the function to your code?

Basically you just need to iterate over the arrays until you find a match, or return -1 if no match is found.

If you don't know how to write a For loop, look here or here.

Or you could just use this code instead:
    Private Function SearchFrom(ByVal startIndex As Integer, _
                    ByVal bedroom As Integer, _
                    ByVal bathroom As Integer, _
                    ByVal proptate As String) As Integer

        MessageBox.Show("You can't afford a House!")
        Return -1

    End Function

Open in new window

0
 

Author Comment

by:John_Lef
ID: 39668849
Can you please show me one example?
I know only basic For Loop, so i dont know how to apply it here
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 500 total points
ID: 39668878
I did give you an example, TWO of them in fact.  Follow the links..,

The first link just shows how to write a generic For loop.
The second link, in Example 2, actually has a For loop that accesses an Array called "rabbits".
0
 

Author Comment

by:John_Lef
ID: 39668953
Oh okay i got it!
I have a final question for #12

    Private Sub searchButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles searchButton.Click
        Dim bedroomSearch As Integer = CInt(bedroomComboBox.SelectedItem)
        Dim bathroomSearch As Integer = CInt(bathroomComboBox.SelectedItem)
        Dim stateSearch As String = CStr(stateComboBox.SelectedItem)
        Dim searchResult As Integer

        searchResult = SearchFrom(0, bedroomSearch, bathroomSearch, stateSearch)

        If searchResult = -1 Then
            MessageBox.Show("Not found!")
        End If
    End Sub

Is there any other way to do #12? I wonder if there is easiler way to do this.
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 39669014
Doesn't get much simpler than that.

If -1 is NOT returned, though, then you should probably display the search result somewhere!  ;)
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question