Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Simple Case statement problem [modified]

Simple Case statement problem [modified]

Scheduled Pinned Locked Moved Visual Basic
questionhelp
17 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Visual Very Basic
    wrote on last edited by
    #1

    Gday, Ok first question....go easy Im trying to make the text in a label change according to what is chosen in a combo box. I dont get why this doesnt change the text in the lblRate. Would appreciate any advice? Private Sub cmbPlanes_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPlanes.SelectedIndexChanged Select Case Aircraft Case "Cessna 152" lblRate.Text = "$119" Case "Cessna 172" lblRate.Text = "$135" Case "Piper Cherokee" lblRate.Text = "$135" Case "Gazelle" lblRate.Text = "$85" Case "Gazelle" lblRate.Text = "$135" Case "Tecnam" lblRate.Text = "$110" Case "Beech Bonanza" lblRate.Text = "$289" Case Else lblRate.Text = "$0.00" End Select End Sub -- modified at 18:37 Saturday 2nd June, 2007

    C D 2 Replies Last reply
    0
    • V Visual Very Basic

      Gday, Ok first question....go easy Im trying to make the text in a label change according to what is chosen in a combo box. I dont get why this doesnt change the text in the lblRate. Would appreciate any advice? Private Sub cmbPlanes_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPlanes.SelectedIndexChanged Select Case Aircraft Case "Cessna 152" lblRate.Text = "$119" Case "Cessna 172" lblRate.Text = "$135" Case "Piper Cherokee" lblRate.Text = "$135" Case "Gazelle" lblRate.Text = "$85" Case "Gazelle" lblRate.Text = "$135" Case "Tecnam" lblRate.Text = "$110" Case "Beech Bonanza" lblRate.Text = "$289" Case Else lblRate.Text = "$0.00" End Select End Sub -- modified at 18:37 Saturday 2nd June, 2007

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      First guess - Aircraft is a variable that is not being changed. I suspect you want to set it from the cmbPlanes combo box. Setting a breakpoint and stepping through would confirm if this is the case.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      V 1 Reply Last reply
      0
      • C Christian Graus

        First guess - Aircraft is a variable that is not being changed. I suspect you want to set it from the cmbPlanes combo box. Setting a breakpoint and stepping through would confirm if this is the case.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        V Offline
        V Offline
        Visual Very Basic
        wrote on last edited by
        #3

        Ok....Im showing my ignorance here but I dont get that. what do you mean set it from the cmbPlanes combo box? If i use the drop down to choose an aircraft I want the lblRate text to change. (which Im sure you already knew) So are u saying that I dont need to declare this as a variable and instead just use cmbPlanes.Text? How do I link the variable named Aircraft to the chosen index in the combobox? second....setting a breakpoint is beyond me at this stage..I have no idea how to do that. Ouch!

        D C 2 Replies Last reply
        0
        • V Visual Very Basic

          Ok....Im showing my ignorance here but I dont get that. what do you mean set it from the cmbPlanes combo box? If i use the drop down to choose an aircraft I want the lblRate text to change. (which Im sure you already knew) So are u saying that I dont need to declare this as a variable and instead just use cmbPlanes.Text? How do I link the variable named Aircraft to the chosen index in the combobox? second....setting a breakpoint is beyond me at this stage..I have no idea how to do that. Ouch!

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          idyot wrote:

          So are u saying that I dont need to declare this as a variable and instead just use cmbPlanes.Text?

          In your case, yes.

          Select Case cmbPlanes.Text

          idyot wrote:

          How do I link the variable named Aircraft to the chosen index in the combobox

          OK. To recant what I just said...If Airplane is a string varible, then all you do is something like this in your posted code:

          Airplane = cmbPlanes.Text
          Select Case Airplane
              Case ....
          

          This is really VB.NET 101 type stuff. I suggest picking up a book on VB.NET for beginners. How you're doing this now isn't really the correct way of doing it in the first place. Normally, you'd have this data (and more) in a DataTable, or some other collection, and bind your controls to this data. Picking an item in the ComboBox would automatically select the rest of the records data. I'm not really going to go into how this works because it's a more advanced technique. Something that will boggle your mind if you don't understand how Select/Case works yet. Seriously, pick up a book or two.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          V 2 Replies Last reply
          0
          • D Dave Kreskowiak

            idyot wrote:

            So are u saying that I dont need to declare this as a variable and instead just use cmbPlanes.Text?

            In your case, yes.

            Select Case cmbPlanes.Text

            idyot wrote:

            How do I link the variable named Aircraft to the chosen index in the combobox

            OK. To recant what I just said...If Airplane is a string varible, then all you do is something like this in your posted code:

            Airplane = cmbPlanes.Text
            Select Case Airplane
                Case ....
            

            This is really VB.NET 101 type stuff. I suggest picking up a book on VB.NET for beginners. How you're doing this now isn't really the correct way of doing it in the first place. Normally, you'd have this data (and more) in a DataTable, or some other collection, and bind your controls to this data. Picking an item in the ComboBox would automatically select the rest of the records data. I'm not really going to go into how this works because it's a more advanced technique. Something that will boggle your mind if you don't understand how Select/Case works yet. Seriously, pick up a book or two.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            V Offline
            V Offline
            Visual Very Basic
            wrote on last edited by
            #5

            Dave Kreskowiak wrote:

            This is really VB.NET 101 type stuff. I suggest picking up a book on VB.NET for beginners.

            Yes its been discussed at length here over the past day or two...Dont know if you agree or not but I think there is no real place or decent books for absolute beginners to learn the code..plenty for form design but not for code, unless your at college I guess ya stuffed. thanks for your help , Ill move on Cheers

            1 Reply Last reply
            0
            • D Dave Kreskowiak

              idyot wrote:

              So are u saying that I dont need to declare this as a variable and instead just use cmbPlanes.Text?

              In your case, yes.

              Select Case cmbPlanes.Text

              idyot wrote:

              How do I link the variable named Aircraft to the chosen index in the combobox

              OK. To recant what I just said...If Airplane is a string varible, then all you do is something like this in your posted code:

              Airplane = cmbPlanes.Text
              Select Case Airplane
                  Case ....
              

              This is really VB.NET 101 type stuff. I suggest picking up a book on VB.NET for beginners. How you're doing this now isn't really the correct way of doing it in the first place. Normally, you'd have this data (and more) in a DataTable, or some other collection, and bind your controls to this data. Picking an item in the ComboBox would automatically select the rest of the records data. I'm not really going to go into how this works because it's a more advanced technique. Something that will boggle your mind if you don't understand how Select/Case works yet. Seriously, pick up a book or two.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007

              V Offline
              V Offline
              Visual Very Basic
              wrote on last edited by
              #6

              Dave Kreskowiak wrote:

              How you're doing this now isn't really the correct way of doing it in the first place. Normally, you'd have this data (and more) in a DataTable, or some other collection, and bind your controls to this data. Picking an item in the ComboBox would automatically select the rest of the records data. I'm not really going to go into how this works because it's a more advanced technique. Something that will boggle your mind if you don't understand how Select/Case works yet.

              Yes I know its not the best, I am just trying to start! I was thinking of using the case satement so later on I could work out how to include a form so that aircraft and rates could be added at will. I have the labels etc working using if statements but was trying to look ahead. Perhaps too far Your right its 101 but the only advice I can get re learning to code is to find a patient and experienced friend to assist or to just ask questions here. As you may be able to tell from my manner..I have no friends :)..so it leaves me one option!

              D 1 Reply Last reply
              0
              • V Visual Very Basic

                Dave Kreskowiak wrote:

                How you're doing this now isn't really the correct way of doing it in the first place. Normally, you'd have this data (and more) in a DataTable, or some other collection, and bind your controls to this data. Picking an item in the ComboBox would automatically select the rest of the records data. I'm not really going to go into how this works because it's a more advanced technique. Something that will boggle your mind if you don't understand how Select/Case works yet.

                Yes I know its not the best, I am just trying to start! I was thinking of using the case satement so later on I could work out how to include a form so that aircraft and rates could be added at will. I have the labels etc working using if statements but was trying to look ahead. Perhaps too far Your right its 101 but the only advice I can get re learning to code is to find a patient and experienced friend to assist or to just ask questions here. As you may be able to tell from my manner..I have no friends :)..so it leaves me one option!

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                I taught myself out of the reference manuals for various languages. I used the books off the shelf for a basis to apply what I saw in the references. So how did I learn the language? Hit F1...

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007

                V 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  I taught myself out of the reference manuals for various languages. I used the books off the shelf for a basis to apply what I saw in the references. So how did I learn the language? Hit F1...

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007

                  V Offline
                  V Offline
                  Visual Very Basic
                  wrote on last edited by
                  #8

                  F1 it is then ciao!

                  1 Reply Last reply
                  0
                  • V Visual Very Basic

                    Ok....Im showing my ignorance here but I dont get that. what do you mean set it from the cmbPlanes combo box? If i use the drop down to choose an aircraft I want the lblRate text to change. (which Im sure you already knew) So are u saying that I dont need to declare this as a variable and instead just use cmbPlanes.Text? How do I link the variable named Aircraft to the chosen index in the combobox? second....setting a breakpoint is beyond me at this stage..I have no idea how to do that. Ouch!

                    C Offline
                    C Offline
                    Christian Graus
                    wrote on last edited by
                    #9

                    idyot wrote:

                    So are u saying that I dont need to declare this as a variable and instead just use cmbPlanes.Text?

                    Yeah, I think Dave has this all covered, but... The combo box contains the selected text. If all you want to do is know what the selected text is, there's no point moving it to another variable, but if yuo have a need to do that, you need to set the value of that variable, it won't set itself.

                    idyot wrote:

                    second....setting a breakpoint is beyond me at this stage..I have no idea how to do that.

                    OK, this is a major thing to know, this will help you a lot. If you put your cursor on a line of code and hit F9, a little dot will appear in the code. Assuming you're running in debug mode ( which is the default ), when you press F5 and the program runs, it will stop at this line of code. You will be able to see the watch window in the bottom area, in this you can type things like cmbPlanes, and you'll see the value of the variable, and if it has properties, you can browse them. You can even call methods in this box, and they will execute immediately, or type things like Airplanes = "Messerschmidt" and the value will change. This is an invaluable tool for working out what's going on inside your code, especially when you don't know why it's not working. You can just hover the mouse over a variable while the code is at a breakpoint and see it's value, so this would have told you, in this case, that Airplane was not being set to the selected text. You can also use the function keys or menu items in the debug menu to step through code, or set which code runs next, so you can really trace exactly what your code is doing, and how this affects the state of your application. Hope that helps. If you're remotely willing to consider C#, I can recommend some good books. Actually, even if you bought a book like 'Inside C#' and used it to learn some overall concepts, C# and VB.NET are basically the same, just different formatting.

                    Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                    V 1 Reply Last reply
                    0
                    • C Christian Graus

                      idyot wrote:

                      So are u saying that I dont need to declare this as a variable and instead just use cmbPlanes.Text?

                      Yeah, I think Dave has this all covered, but... The combo box contains the selected text. If all you want to do is know what the selected text is, there's no point moving it to another variable, but if yuo have a need to do that, you need to set the value of that variable, it won't set itself.

                      idyot wrote:

                      second....setting a breakpoint is beyond me at this stage..I have no idea how to do that.

                      OK, this is a major thing to know, this will help you a lot. If you put your cursor on a line of code and hit F9, a little dot will appear in the code. Assuming you're running in debug mode ( which is the default ), when you press F5 and the program runs, it will stop at this line of code. You will be able to see the watch window in the bottom area, in this you can type things like cmbPlanes, and you'll see the value of the variable, and if it has properties, you can browse them. You can even call methods in this box, and they will execute immediately, or type things like Airplanes = "Messerschmidt" and the value will change. This is an invaluable tool for working out what's going on inside your code, especially when you don't know why it's not working. You can just hover the mouse over a variable while the code is at a breakpoint and see it's value, so this would have told you, in this case, that Airplane was not being set to the selected text. You can also use the function keys or menu items in the debug menu to step through code, or set which code runs next, so you can really trace exactly what your code is doing, and how this affects the state of your application. Hope that helps. If you're remotely willing to consider C#, I can recommend some good books. Actually, even if you bought a book like 'Inside C#' and used it to learn some overall concepts, C# and VB.NET are basically the same, just different formatting.

                      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                      V Offline
                      V Offline
                      Visual Very Basic
                      wrote on last edited by
                      #10

                      Gday again. Yeah Ive been working through it all using F1.....niot easy when you dont really know what ya searching for but here is where Im at! I got it working using the case select after what you said earlier. It made sense after I thought about it for a while, so Im pretty happy with that now. Where Im stuck now (hesitating to ask cos its 101 stuff again) is converting a string to a value so it can be used for calculations. Looked in books , looked in F1 and have this working but I doubt its the right way lblRate.Text = Format(lblRate.Text, "currency") and lblTotalAircraftCost.Text = AircraftRate * (Val(txtAircraftHours.Text)) Now Im sure your all wetting ya'selves laughing right now, but Im 100 miles ahead of where I was 8 hours ago so Im happy...and happy to give ya'all a laugh at my expense! :) Cheers Mate Id be happy to consider anything if u know of any decent books, I dont wanna clog the forum up with uneducated stupid questions...you know I reckon this is like golf...frustrating as hell but when ya get that one thing that goes right it keeps ya coming back for more!

                      C D P 3 Replies Last reply
                      0
                      • V Visual Very Basic

                        Gday again. Yeah Ive been working through it all using F1.....niot easy when you dont really know what ya searching for but here is where Im at! I got it working using the case select after what you said earlier. It made sense after I thought about it for a while, so Im pretty happy with that now. Where Im stuck now (hesitating to ask cos its 101 stuff again) is converting a string to a value so it can be used for calculations. Looked in books , looked in F1 and have this working but I doubt its the right way lblRate.Text = Format(lblRate.Text, "currency") and lblTotalAircraftCost.Text = AircraftRate * (Val(txtAircraftHours.Text)) Now Im sure your all wetting ya'selves laughing right now, but Im 100 miles ahead of where I was 8 hours ago so Im happy...and happy to give ya'all a laugh at my expense! :) Cheers Mate Id be happy to consider anything if u know of any decent books, I dont wanna clog the forum up with uneducated stupid questions...you know I reckon this is like golf...frustrating as hell but when ya get that one thing that goes right it keeps ya coming back for more!

                        C Offline
                        C Offline
                        Christian Graus
                        wrote on last edited by
                        #11

                        idyot wrote:

                        Now Im sure your all wetting ya'selves laughing right now

                        Not at all - I remember being new to all this stuff, I'm not THAT old or cynical :P There are many ways to turn a string into a number. By far the best is to do this: Dim hours as int if (int.TryParse(txtAircraftHours.Text, hours)) then lblTotalAircraftCost.Text = AircraftRate * hours end if Now, here's a funny thing. I don't use VB.NET. I help here because most questions I can answer as they relate to the framwork. So, I *think* this works because VB will turn a number into a string by magic ( I think your code was doing this also ). int.TryParse *definately* takes a string and an int, and if it can convert the string to an int, it sets the int value and returns true. This means it checks for you and won't blow up ( as other methods will ), if the string is not convertible.

                        idyot wrote:

                        frustrating as hell but when ya get that one thing that goes right it keeps ya coming back for more!

                        Yeah, I can still remember how excited I was when I got my first little c++ projects to do something. The book Inside C# by Tom Archer is a pretty decent overview of the C# language. If you get it, be sure to get the second edition, even that is out of date. But, it's a good, language focused book.

                        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                        V 1 Reply Last reply
                        0
                        • C Christian Graus

                          idyot wrote:

                          Now Im sure your all wetting ya'selves laughing right now

                          Not at all - I remember being new to all this stuff, I'm not THAT old or cynical :P There are many ways to turn a string into a number. By far the best is to do this: Dim hours as int if (int.TryParse(txtAircraftHours.Text, hours)) then lblTotalAircraftCost.Text = AircraftRate * hours end if Now, here's a funny thing. I don't use VB.NET. I help here because most questions I can answer as they relate to the framwork. So, I *think* this works because VB will turn a number into a string by magic ( I think your code was doing this also ). int.TryParse *definately* takes a string and an int, and if it can convert the string to an int, it sets the int value and returns true. This means it checks for you and won't blow up ( as other methods will ), if the string is not convertible.

                          idyot wrote:

                          frustrating as hell but when ya get that one thing that goes right it keeps ya coming back for more!

                          Yeah, I can still remember how excited I was when I got my first little c++ projects to do something. The book Inside C# by Tom Archer is a pretty decent overview of the C# language. If you get it, be sure to get the second edition, even that is out of date. But, it's a good, language focused book.

                          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                          V Offline
                          V Offline
                          Visual Very Basic
                          wrote on last edited by
                          #12

                          Hey I got that working ok...thanks heaps! Last thing for now :) ..if you could at least point me in the right direction and Ill try to work the rest out The combo box holds a collection of items, right now they are checked directly in Select Case, what I would like to do now, is , as suggested (I think) before by Dave is to set it up so that the using the dropdown menu to select the aircraft, automatically populates the labels etc with data from a table somewhere. The idea being the a new aircraft can be added, prices change, aircraft removed etc..all from another form, without having to go into the code to change aircraft names/rates etc. And I am aware that its prolly way above my current skill level but I wouldnt mind having a crack Now I dont expect you to tell exactly how to do it but I would appreciate someone telling me what it is Im searching for in the MSDN or other. Often Im finding the problem is not knowing the right stuff to search for..

                          C 1 Reply Last reply
                          0
                          • V Visual Very Basic

                            Hey I got that working ok...thanks heaps! Last thing for now :) ..if you could at least point me in the right direction and Ill try to work the rest out The combo box holds a collection of items, right now they are checked directly in Select Case, what I would like to do now, is , as suggested (I think) before by Dave is to set it up so that the using the dropdown menu to select the aircraft, automatically populates the labels etc with data from a table somewhere. The idea being the a new aircraft can be added, prices change, aircraft removed etc..all from another form, without having to go into the code to change aircraft names/rates etc. And I am aware that its prolly way above my current skill level but I wouldnt mind having a crack Now I dont expect you to tell exactly how to do it but I would appreciate someone telling me what it is Im searching for in the MSDN or other. Often Im finding the problem is not knowing the right stuff to search for..

                            C Offline
                            C Offline
                            Christian Graus
                            wrote on last edited by
                            #13

                            The core question is, how will you store the information ? I'd lean towards an XML file, which means you need to go to the w3c site to read their tutorials on XPath, so you know how to search your XML to get the values out. A database is probably easier to search, but more work to set up. SQL Server Express is free, if you wanted to try that instead. If you set up XML like Messerschmidt 1942 German 2 ( or whatever data you want, obviously ) then you can load it into an XmlDocument with the Load method, and do a foreach on document.SelectNodes("/airplanes/plane") which will give you a node for each group, then you can do node.SelectSingleNode("name") for the node with the name, etc.

                            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                            V 1 Reply Last reply
                            0
                            • V Visual Very Basic

                              Gday, Ok first question....go easy Im trying to make the text in a label change according to what is chosen in a combo box. I dont get why this doesnt change the text in the lblRate. Would appreciate any advice? Private Sub cmbPlanes_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPlanes.SelectedIndexChanged Select Case Aircraft Case "Cessna 152" lblRate.Text = "$119" Case "Cessna 172" lblRate.Text = "$135" Case "Piper Cherokee" lblRate.Text = "$135" Case "Gazelle" lblRate.Text = "$85" Case "Gazelle" lblRate.Text = "$135" Case "Tecnam" lblRate.Text = "$110" Case "Beech Bonanza" lblRate.Text = "$289" Case Else lblRate.Text = "$0.00" End Select End Sub -- modified at 18:37 Saturday 2nd June, 2007

                              D Offline
                              D Offline
                              Dave Sexton
                              wrote on last edited by
                              #14

                              This may be a dumb question but are you doing this as a WinForms project or is it a web app? If a web app, check that you've set the drop down list to trigger an AutoPostBack (I think it's called that or something similar on the properties sheet). Just the fact that you've called it a combo box and not a drop down list leans me to believe this is a WinForms thing but I'm just trying to eliminate the impossible.

                              1 Reply Last reply
                              0
                              • V Visual Very Basic

                                Gday again. Yeah Ive been working through it all using F1.....niot easy when you dont really know what ya searching for but here is where Im at! I got it working using the case select after what you said earlier. It made sense after I thought about it for a while, so Im pretty happy with that now. Where Im stuck now (hesitating to ask cos its 101 stuff again) is converting a string to a value so it can be used for calculations. Looked in books , looked in F1 and have this working but I doubt its the right way lblRate.Text = Format(lblRate.Text, "currency") and lblTotalAircraftCost.Text = AircraftRate * (Val(txtAircraftHours.Text)) Now Im sure your all wetting ya'selves laughing right now, but Im 100 miles ahead of where I was 8 hours ago so Im happy...and happy to give ya'all a laugh at my expense! :) Cheers Mate Id be happy to consider anything if u know of any decent books, I dont wanna clog the forum up with uneducated stupid questions...you know I reckon this is like golf...frustrating as hell but when ya get that one thing that goes right it keeps ya coming back for more!

                                D Offline
                                D Offline
                                Dave Kreskowiak
                                wrote on last edited by
                                #15

                                idyot wrote:

                                Where Im stuck now (hesitating to ask cos its 101 stuff again) is converting a string to a value so it can be used for calculations. Looked in books , looked in F1 and have this working but I doubt its the right way

                                Well, we're not laughing at you. We all had to learn the languages somehow. The trick to learning the language isn't trying to write an application while you don't know the language. You're trying to put together a puzzle without knowing what the pieces look like. Turn this around and learn what the puzzle pieces look like first. How I did it was to look at some functions in the references and write tiny apps to see how they worked. Stepping through them with the debugger and examining the values. Changing tiny pieces here and there to see what effect they had. Learn what the basic data types are and what the functions and method are looking for in their parameters and what types they return. I can pickup and learn any language I want in a very short time because I completely understand all the basic types and how OOP works.

                                A guide to posting questions on CodeProject[^]
                                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                                     2006, 2007

                                1 Reply Last reply
                                0
                                • V Visual Very Basic

                                  Gday again. Yeah Ive been working through it all using F1.....niot easy when you dont really know what ya searching for but here is where Im at! I got it working using the case select after what you said earlier. It made sense after I thought about it for a while, so Im pretty happy with that now. Where Im stuck now (hesitating to ask cos its 101 stuff again) is converting a string to a value so it can be used for calculations. Looked in books , looked in F1 and have this working but I doubt its the right way lblRate.Text = Format(lblRate.Text, "currency") and lblTotalAircraftCost.Text = AircraftRate * (Val(txtAircraftHours.Text)) Now Im sure your all wetting ya'selves laughing right now, but Im 100 miles ahead of where I was 8 hours ago so Im happy...and happy to give ya'all a laugh at my expense! :) Cheers Mate Id be happy to consider anything if u know of any decent books, I dont wanna clog the forum up with uneducated stupid questions...you know I reckon this is like golf...frustrating as hell but when ya get that one thing that goes right it keeps ya coming back for more!

                                  P Offline
                                  P Offline
                                  Paul Conrad
                                  wrote on last edited by
                                  #16

                                  idyot wrote:

                                  I dont wanna clog the forum up with uneducated stupid questions...

                                  I don't think you are clogging up the forums with your questions. You are learning and this isn't a bad place to ask for help.

                                  idyot wrote:

                                  know of any decent books

                                  Not sure if one exists. You may want to look at Apress VB.Net books[^]. I've picked a few of their books in the past, primarily SQL 2005 books, and they seem pretty alright :-D A few decent books, codeproject, and google, you'll be set :)


                                  "The clue train passed his station without stopping." - John Simmons / outlaw programmer

                                  1 Reply Last reply
                                  0
                                  • C Christian Graus

                                    The core question is, how will you store the information ? I'd lean towards an XML file, which means you need to go to the w3c site to read their tutorials on XPath, so you know how to search your XML to get the values out. A database is probably easier to search, but more work to set up. SQL Server Express is free, if you wanted to try that instead. If you set up XML like Messerschmidt 1942 German 2 ( or whatever data you want, obviously ) then you can load it into an XmlDocument with the Load method, and do a foreach on document.SelectNodes("/airplanes/plane") which will give you a node for each group, then you can do node.SelectSingleNode("name") for the node with the name, etc.

                                    Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                                    V Offline
                                    V Offline
                                    Visual Very Basic
                                    wrote on last edited by
                                    #17

                                    I have finally found a good VB.NET book, purchased it today and am already through the first 4 chapters....Deitels How to program in Visual Basic.NET. Its the first one Ive found that actually DOES talk about HOW to program in VB.NET and doesnt spend 75% of the book on form design! Ordered the Inside C# book you mentioned, by the time it arrives I should have more of an idea of whats going on! Cheers

                                    1 Reply Last reply
                                    0
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    • Login

                                    • Don't have an account? Register

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • World
                                    • Users
                                    • Groups