Ask your own question, for FREE!
Computer Science 10 Online
OpenStudy (poopsiedoodle):

[VB.NET] Conversion from string ":0" to type 'Integer' is not valid.

OpenStudy (poopsiedoodle):

I'm making a clock application where the user can set the time, and this is the code I'm using to set the minute to a lower minute: `Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.click` `Dim newmin As Integer` `Dim currmin As Integer` `currmin = RichTextBox1.Text.Substring(RichTextBox1.Text.IndexOf(":"), 2)` <line with the error `newmin = currmin - 1` `End Sub` The text in the richtextbox is `00:00`, but I'm not sure why the error is occurring. Any thoughts? @Opcode halp while I eat dinner? ;)

OpenStudy (poopsiedoodle):

also, @bibby I don't remember if u even pro0grimm or nawt but halp pl0x

OpenStudy (poopsiedoodle):

Btw, it should be pulling the text from after the `:` and not the `:` itself.

OpenStudy (bibby):

Idk how the strings work in vb. try putting quote marks around the 2

OpenStudy (poopsiedoodle):

That's not a string. It's specifying the length (of chars) to read.

OpenStudy (bibby):

oh I have no idea lol

OpenStudy (poopsiedoodle):

well dangflabbit, bibby >.>

OpenStudy (opcode):

Well if it's anything like C#, you should have 2, in round brackets.

OpenStudy (poopsiedoodle):

Not necessary.

OpenStudy (poopsiedoodle):

@nincompoop

OpenStudy (anonymous):

Might be an boundary error. Try changing `RichTextBox1.Text.IndexOf(":")` into `RichTextBox1.Text.IndexOf(":") + 1`

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!