Finray
Hup! Dos, Tres, Cuatro
+2,629|6003|Catherine Black
I've got to put code into a program which takes the first and last three letters of an item, and from that creates a product code.

For example:

Simpson GN120 to make Sim120.

Anyone know the code on how to do this?
https://i.imgur.com/qwWEP9F.png
liquidat0r
wtf.
+2,223|6842|UK
Using string manipulation. Something like this:

Code:

mystring = "Simpson GN120"

mynewstring = Left$(mystring,3) & Right$(mystring,3)

print mynewstring
(I don't really know VB)
jsnipy
...
+3,276|6737|...

Code:

dim mystring = "Simpson GN120"
dim myCode = mystring.Substring(0,3) + mystring.Substring(mystring.Length -3)

'do something with myCode

Last edited by jsnipy (2009-11-23 04:21:05)

Finray
Hup! Dos, Tres, Cuatro
+2,629|6003|Catherine Black
Cheers for the help.
https://i.imgur.com/qwWEP9F.png
Finray
Hup! Dos, Tres, Cuatro
+2,629|6003|Catherine Black
Need some more help, I'm trying to make a messagebox come up with text saying "Stock level is" and then the stock level, and then "."

Code:

stock_display = MsgBox("Stock level is " + stock + ".")
I've got that but it's not working. Thoughts?
https://i.imgur.com/qwWEP9F.png
liquidat0r
wtf.
+2,223|6842|UK
What about it doesn't work?
Finray
Hup! Dos, Tres, Cuatro
+2,629|6003|Catherine Black

liquidat0r wrote:

What about it doesn't work?
"Conversion from "Stock level is" to "Double" is not valid".

i donno lol
https://i.imgur.com/qwWEP9F.png
liquidat0r
wtf.
+2,223|6842|UK
I guess the error isn't on that line. The error is something to do with the fact that you've mixed up data types (integer, double).

But like I said, I don't know any VB.
Finray
Hup! Dos, Tres, Cuatro
+2,629|6003|Catherine Black

liquidat0r wrote:

I guess the error isn't on that line. The error is something to do with the fact that you've mixed up data types (integer, double).

But like I said, I don't know any VB.
Bummer.

Oh well I worked around it by displaying the stock in a label on the form, rather than a msgbox. Thanks anyway.
https://i.imgur.com/qwWEP9F.png
Nessie09
I "fix" things
+107|6885|The Netherlands

Finray wrote:

Need some more help, I'm trying to make a messagebox come up with text saying "Stock level is" and then the stock level, and then "."

Code:

stock_display = MsgBox("Stock level is " + stock + ".")
I've got that but it's not working. Thoughts?
Use & instead of +
that should work.

Board footer

Privacy Policy - © 2024 Jeff Minard