Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VB Problem

Options
  • 06-11-2005 12:58am
    #1
    Registered Users Posts: 1,987 ✭✭✭


    I'm trying to get the text from a text box on one form and save it as an option in a combobox on aanother form, this is the code I have for it:

    frmDVRFolderSwitch.cboSource.Items.Add = txtSiteName.Text

    I get this error:

    Error 1
    Argument not specified for parameter 'item' of 'Public Function Add(item As
    Object) As Integer'.
    C:\Documents and Settings\Admin\Desktop\24-7 Backup\DVR\DVR\add.vb 11 9
    DVR


    Can anyone help me?


Comments

  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    I'm not 100% sure... but isn't the syntax:

    frmDVRFolderSwitch.cboSource.Items.Add(txtSiteName.Text);


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    Thanks, that worked.


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    how do you day not equal to:

    example:

    IF (strOne <> "") AND (strTwo <> "") THEN

    is that right, i want it to make sure that there is something entered into the two variables before it will go through this loop.


  • Registered Users Posts: 43,774 ✭✭✭✭Basq


    Ziycon wrote:
    how do you day not equal to:

    example:

    IF (strOne <> "") AND (strTwo <> "") THEN

    is that right, i want it to make sure that there is something entered into the two variables before it will go through this loop.
    Been a while since i done VB but isn't there built-in functions for this. Think there's IsEmpty which returns boolean true if it is empty and false if not empty...

    Try:

    If(IsEmpty(strOne) And IsEmpty(strTwo)) Then
    ...


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    basquille wrote:
    Been a while since i done VB but isn't there built-in functions for this. Think there's IsEmpty which returns boolean true if it is empty and false if not empty...

    Try:

    If(IsEmpty(strOne) And IsEmpty(strTwo)) Then
    ...

    'Empty' isnt used anhymore in .NET Studio its 'Nothing' now!

    Thanks.


  • Advertisement
  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    Another question while im at it, can anyone tell me how to create an array to store a name and a directory location that are read in from txt boxes? I've never done arrays in vb only in java!


  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    Not sure of the syntax, i'm a .NET guy myself (my previous post was a complete guess :P). But it might be something like this...

    Dim MyArray(2) as string;

    then store the name in position1 and the path in position2 as required. Probably the handiest way. If in doubt, google is your friend.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Ziycon wrote:
    Another question while im at it, can anyone tell me how to create an array to store a name and a directory location that are read in from txt boxes? I've never done arrays in vb only in java!
    RTFM / STFW

    A quick Google on "arrays vb" will throw up numerous tutorials on that question, and in fairness all your other questions can be solved just as easily using Google or the MSDN.


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    RTFM / STFW

    A quick Google on "arrays vb" will throw up numerous tutorials on that question, and in fairness all your other questions can be solved just as easily using Google or the MSDN.

    I've google'd and used msdn and haven't been able to find what im looking for hence why im here.


  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    try here: http://url.ie/i5


  • Advertisement
  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Ziycon wrote:
    I've google'd and used msdn and haven't been able to find what im looking for hence why im here.
    No you haven't. Even simple Google queries will get you what you want, so you've not made any effort or you have no idea how to use a search engine.


  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    No you haven't. Even simple Google queries will get you what you want, so you've not made any effort or you have no idea how to use a search engine.
    If you don't know how to use a search engine, just look up a few techniques here: http://url.ie/ds

    (sorry, that had to be done :P)


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    No you haven't. Even simple Google queries will get you what you want, so you've not made any effort or you have no idea how to use a search engine.

    Say wot u want man, but i have tried and have found stuff but as i said before i haven't been able to find what im looking for!


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    Last question i hope:

    I HAVE looked for this but cant find the answer, when i close the application everything added to the application and its arrays all dissappears, whats it called or do you know how to do it. I want to application to keep everything that was added, so when its opened again or the system is restarted that it will still have the data!???


  • Registered Users Posts: 195 ✭✭DecTenToo


    I just did a quick google search "vb 6 save load data" which is what you want to do.

    When you application starts you need to read a file and load the values and when the app closes, you need to save the values in the same file. There are plenty of examples.

    Have a look at www.vb-helper.com - plenty of examples.

    What kind of programming course are you doing - sounds poor to me?


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Ziycon wrote:
    Say wot u want man, but i have tried and have found stuff but as i said before i haven't been able to find what im looking for!
    Let’s look at your questions:
    • How to add an item to a combobox? This is a basic syntax issue - a classic RTFM question.
    • Was the syntax of a line of code right? Try it and see. If it behaves in the way you expect it to behave, then it’s right - otherwise, it’s not. There are only four possible permutations for that IF statement anyway, so it wasn’t going to take that long to test it - probably a lot less than posting for the answer.
    • How do arrays work in VB? Search Google for " arrays vb example" and guess what? You get examples of how to create and manipulate arrays in VB.
    • How do I make my data persistent? Again, as has already pointed out to you, a simple Google search will give you what you want. Of course, from the way you phrased the question, I actually get the impression that you’d not even bothered to think through what you wanted, as it was incredibly vague - at least I would have expected a more specific “how do you save the data to a file so that I can reload it later?” question.
    So no, you’ve put practically no effort (and that’s giving you the benefit of the doubt) in searching for answers before coming here and looking to be spoon-fed.

    If this is course work, I would strongly recommend you change what you’re presently studying to something more literary.


  • Registered Users Posts: 4,003 ✭✭✭rsynnott


    If this is course work, I would strongly recommend you change what you’re presently studying to something more literary.

    That's not really fair. Although we certainly shouldn't be answering the question, he may just be getting off to a slow start in his course. Often these things aren't taught very well.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    rsynnott wrote:
    That's not really fair. Although we certainly shouldn't be answering the question, he may just be getting off to a slow start in his course. Often these things aren't taught very well.
    No one is chastising him for not knowing something - for which his course might be to blame. However, it can hardly be held responsible for his indolence.


  • Registered Users Posts: 4,003 ✭✭✭rsynnott


    No, no, I agree that he's being a bit lazy; it's just not fair to say he should give up at this point.


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    Ok, i will admit i may not know how to search properly on search enegines cause i rarely use them but i did try and find my information there first!
    Also we are only taught vb for 6 months for 3 hours a week in the course so we dont really get a grip of it!
    The application im writing isnt for my course, its as a favour for a friend!

    Thanks for the help people! Sorry to annoy some of you!


  • Advertisement
  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Ziycon wrote:
    Ok, i will admit i may not know how to search properly on search enegines cause i rarely use them but i did try and find my information there first!
    Then use them and learn. It’s not rocket science. How do you think any of us learned?
    Also we are only taught vb for 6 months for 3 hours a week in the course so we dont really get a grip of it!
    You mean you don’t study or research at home? You never look at it outside of your course hours?

    Development is not something you learn from doing the bare minimum. You genuinely have to work on it in your own time, on your own projects - experiment and find your own solutions. After all, once you leave college you won’t be able to stop learning - technology will not be standing still simply because you’ve got your qualification, and if you don’t put in the time to research and experiment you’ll find that you’ll fall behind your peers within a few years (it’s easy to realise when this happens, they’ll be earning a lot more than you).

    Regardless of your motivation, this extracurricular project is a good idea, but only if you choose to learn from the experience. Use the opportunity to learn how to use search engines and how to ask questions on technical lists and boards without getting flamed. Figure out solutions to problems yourself - logic and lateral thinking are probably the two greatest qualities that any developer can have, IMHO.

    Seriously, as I said, programming is not a profession that you can get away doing the bare minimum. I’ve seen dozens who have attempted to do so and they’re no longer programming (and by that I don’t mean that they went on to management / analysis). They just couldn’t keep up.


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    Then use them and learn. It’s not rocket science. How do you think any of us learned?

    archie...
    gopher....

    Man, when altavista came along, I thought all my Christmases had come at once.

    jc


  • Closed Accounts Posts: 3,357 ✭✭✭Beano


    bonkey wrote:
    archie...
    gopher....

    Man, when altavista came along, I thought all my Christmases had come at once.

    jc


    And before all that we actually read printed manuals. I still remember the first day of my first job being handed a 2 foot high stack of manuals for MS Visual C++ V1.5. Good times, good times. But try telling that to the young pups in college today and they wont believe you.


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    Then use them and learn. It’s not rocket science. How do you think any of us learned?

    You mean you don’t study or research at home? You never look at it outside of your course hours?

    Development is not something you learn from doing the bare minimum. You genuinely have to work on it in your own time, on your own projects - experiment and find your own solutions. After all, once you leave college you won’t be able to stop learning - technology will not be standing still simply because you’ve got your qualification, and if you don’t put in the time to research and experiment you’ll find that you’ll fall behind your peers within a few years (it’s easy to realise when this happens, they’ll be earning a lot more than you).

    Regardless of your motivation, this extracurricular project is a good idea, but only if you choose to learn from the experience. Use the opportunity to learn how to use search engines and how to ask questions on technical lists and boards without getting flamed. Figure out solutions to problems yourself - logic and lateral thinking are probably the two greatest qualities that any developer can have, IMHO.

    Seriously, as I said, programming is not a profession that you can get away doing the bare minimum. I’ve seen dozens who have attempted to do so and they’re no longer programming (and by that I don’t mean that they went on to management / analysis). They just couldn’t keep up.

    The reason i dont research it is cause i dont use it anymore! i Only use Java and C++!


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Ziycon wrote:
    The reason i dont research it is cause i dont use it anymore! i Only use Java and C++!
    You’ve completely missed the point of what others and I have said.

    The reason you don’t research is because you don’t research (by your own admission you don’t know how to use a search engine). The skills involved in researching a problem with VB are the same as with Java, PHP, COBOL, C++, C# or whatever else you’re coding in.

    Problem is that once your course is over and you go into the Big Bad World, stuff will crop up (when using Java or C++) that you won’t be able to solve without either getting someone to show you or research and work out a solution on your own. As you can’t do the latter, you’re not going to look very good - after all, your work colleagues are not your tutors; they’re not there to answer your questions.

    That you’ve decided to largely ignore VB is your own business, although, given you need it now for your friend’s application should be sending you a message that ignoring it is may not be such a good idea. Think of that when you can’t apply for a job because you need to know VB for it.


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    No i didnt, the way i understand it, what was being said is that i didnt bother to research it as i was learning it! The reason i came here was to get help, i have tired to research it but found it difficult due to not doing VB in over 2years and now trying to use Visual Studio where a lot of keywords have changed and some structures are different!

    I also understand where your coming from!


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Ziycon wrote:
    No i didnt, the way i understand it, what was being said is that i didnt bother to research it as i was learning it!
    No, that is not what was being said.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Ziycon wrote:
    No i didnt, the way i understand it, what was being said is that i didnt bother to research it as i was learning it! The reason i came here was to get help, i have tired to research it but found it difficult due to not doing VB in over 2years and now trying to use Visual Studio where a lot of keywords have changed and some structures are different!

    I also understand where your coming from!

    TBH part of my research into problems is asking questions on this board, you are just learning so don't take it to heart too much. Visual Studio's help wasn't great at the best of times - better off using google.


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    Evil Phil wrote:
    Visual Studio's help wasn't great at the best of times

    I always thought the help for VB5 was outstanding.

    From there, MS aparently decided to aim their targets for quality downwards at as steep an angle as was achievable.


  • Advertisement
Advertisement