-
Aug 24th, 2009, 02:06 AM
#1
Thread Starter
Lively Member
-
Aug 24th, 2009, 02:16 AM
#2
Re: Error:Comma,),Valid... Cant get to work
That would be the .NET section right above this one.
-
Aug 24th, 2009, 02:16 AM
#3
Re: Error:Comma,),Valid... Cant get to work
But maybe it's from this line?
items.Add("Set oWMP = CreateObject("WMPlayer.OCX.7"")
-
Aug 24th, 2009, 02:37 AM
#4
Thread Starter
Lively Member
Re: Error:Comma,),Valid... Cant get to work
But i don't know what to do to change that line in the code. I have tried adding commas and ) in that line but cant seem to get it to work. I am not sure what else to do?
-
Aug 24th, 2009, 05:21 AM
#5
Re: Error:Comma,),Valid... Cant get to work
Thread moved from 'VB6 and Earlier' forum to 'VB.Net' (VB2002 and later) forum
-
Aug 24th, 2009, 02:08 PM
#6
Thread Starter
Lively Member
Re: Error:Comma,),Valid... Cant get to work
Anyone else have any suggestions for how I could fix this?
Thanks for the comments so far!
-
Aug 24th, 2009, 02:28 PM
#7
Re: Error:Comma,),Valid... Cant get to work
I would have to say that the problem is on this line:
items.Add("Set oWMP = CreateObject("WMPlayer.OCX.7"")
It's really noticeable
-
Aug 24th, 2009, 02:33 PM
#8
Thread Starter
Lively Member
Re: Error:Comma,),Valid... Cant get to work
Thanks,
got this fixed.
items.Add("Set oWMP = CreateObject(""WMPlayer.OCX.7"")")
The code is above if anyone else has this problem.
Thanks to ForumAccount for the help with this code.
Last edited by VisualBasic2008; Aug 24th, 2009 at 02:39 PM.
-
Aug 24th, 2009, 02:39 PM
#9
Re: [RESOLVED] Error:Comma,),Valid... Cant get to work
You have the string termination in the middle of the string:
Code:
items.Add("Set oWMP = CreateObject("WMPlayer.OCX.7"")
and it should be changed so the quotes in the middle of the string are escaped:
Code:
items.Add("Set oWMP = CreateObject(""WMPlayer.OCX.7""")
-
Aug 24th, 2009, 02:42 PM
#10
Thread Starter
Lively Member
Re: [RESOLVED] Error:Comma,),Valid... Cant get to work
Thanks JuggaloBrotha,
You helped clear it up for me, I got it working now.
Thanks again everybody.
-
Aug 25th, 2009, 06:31 AM
#11
Re: [RESOLVED] Error:Comma,),Valid... Cant get to work
-
Aug 25th, 2009, 06:37 AM
#12
Re: [RESOLVED] Error:Comma,),Valid... Cant get to work
Once again, what is "items"?
What are you trying to do? It looks as though you are trying to put some VB code into your TextBox manually.
I advice you to use a StringBuilder, where you can do something like:
Code:
Dim sb As New StringBuilder
sb.AppendLine("Line 1 of paragraph")
sb.AppendLine("Line 2 of paragraph")
etc...
TextBox1.Text = sb.ToString()
Of course, you will still have to type "sb.AppendLine" for every line. There's not much you can about that. Maybe you could do this:
Code:
Dim nl As String = Environment.NewLine
Dim str As String = "Line 1 of paragraph" & nl & _
"Line2 of paragraph" & nl & _
"Line3 of paragraph" & nl & _
...
TextBox1.Text = str
But that becomes hard to maintain and doesn't really save that much typing. sb.AppendLine costs only 3 or 4 keystrokes if you use Intellisense.
-
Aug 25th, 2009, 04:40 PM
#13
Thread Starter
Lively Member
Re: [RESOLVED] Error:Comma,),Valid... Cant get to work
Hello,
Thanks Nick for the post I think you solved my main problem. But to answer you question about what is "items". I am not exactly sure (just started VB so am not sure exactly what everything means) but I think my items is the line in the paragraph. So items is line 1-50 of paragraph.
Sorry if that doesn't answer your question, I am a little confused.
Thanks everyone for your posts, I really appreciate everyones help.
-
Aug 25th, 2009, 04:45 PM
#14
Thread Starter
Lively Member
Re: [RESOLVED] Error:Comma,),Valid... Cant get to work
P.S. Sorry, I forgot to add , just wanted to say to Nick that what I was trying to do is have it so that I didn't have to keep typing the same paragraph over and over again for a tutorial. I am writing a tutorial for my friend and I found my self writing the same paragraph a couple of times over. So I thought there must be an easier way. And I made this program to help solve this problem and any future problems similar to this.
Thanks again!
-
Aug 24th, 2009, 02:28 PM
#15
Re: Adding list in textbox without items.Add("")
Are you actually trying to add the string:
Set oWMP = CreateObject("WMPlayer.OCX.7")
into the items? If so, you have to double up the double quotes like so:
vb.net Code:
items.Add("Set oWMP = CreateObject(""WMPlayer.OCX.7"")")
-
Aug 24th, 2009, 02:31 PM
#16
Re: Adding list in textbox without items.Add("")
Didn't see the double post here. In the future please don't post a topic twice.
-
Aug 24th, 2009, 02:34 PM
#17
Thread Starter
Lively Member
Re: Adding list in textbox without items.Add("")
Oh OK,
Sorry about the double post.
Thanks you very much though for the comment and sorry again.
-
Aug 24th, 2009, 02:59 PM
#18
Thread Starter
Lively Member
Re: Adding list in textbox without items.Add("")
About my first question.
If I made changed it from a text box to a list box to I still need to add
To each line that I want to be added.
Thanks everybody.
-
Aug 24th, 2009, 06:05 PM
#19
Re: Adding list in textbox without items.Add("")
I might not be understanding what you're doing, but if you're adding text (or lines) to a textbox then "Items.Add" does not apply, you just append the text (or lines) to the existing text.
- If my post helped you, please Rate it
- If your problem is solved please also mark the thread resolved
I use VS2015 (unless otherwise stated).
_________________________________________________________________________________
B.Sc(Hons), AUS.P, C.Eng, MIET, MIEEE, MBCS / MCSE+Sec, MCSA+Sec, MCP, A+, Net+, Sec+, MCIWD, CIWP, CIWA
I wrote my very first program in 1979, using machine code on a mechanical Olivetti teletype connected to an 8-bit, 78 instruction, 1MHz, Motorola 6800 multi-user system with 2k of memory. Using Windows, I dont think my situation has improved.
-
Aug 24th, 2009, 08:24 PM
#20
Thread Starter
Lively Member
Re: Adding list in textbox without items.Add("")
Hey Bulldog, thanks for the reply,
What I am making is when someone checks a check box, which would be check box1,2,and3. The check box that is checked will add a certain paragraph to the text box which can then be saved as a .txt document.
So if had checked checkbox1 a paragraph would be added. The paragraph is too long to post but it is just 40 lines or so of text.
What i am wondering is if there is a way so that I could add the whole paragraph in the code without having to put items.Add("") before each new line in the paragraph. So i could add the paragraph and it will still make new lines and such just like items.Add but a lot easier and faster.
Here is a small example of what I have now.
Code:
If Me.Checkbox1.Checked then
items.Add("Line 1 of paragraph")
items.Add("Line 2 of paragraph")
items.Add("All the way till Line 40 of paragraph")
Thanks for any help in advance and thanks Bulldog and ForumAccount for your replies.
-
Aug 25th, 2009, 06:10 AM
#21
Re: Adding list in textbox without items.Add("")
If your paragraph is text, then you can do that in one line. By text, I mean a very long string, rather than a collection of individual lines.
If CheckBox1.Checked Then YourTextBox.Text = YourParagraph
If your paragraphs are already 'lines', then you could add them together into strings.
- If my post helped you, please Rate it
- If your problem is solved please also mark the thread resolved
I use VS2015 (unless otherwise stated).
_________________________________________________________________________________
B.Sc(Hons), AUS.P, C.Eng, MIET, MIEEE, MBCS / MCSE+Sec, MCSA+Sec, MCP, A+, Net+, Sec+, MCIWD, CIWP, CIWA
I wrote my very first program in 1979, using machine code on a mechanical Olivetti teletype connected to an 8-bit, 78 instruction, 1MHz, Motorola 6800 multi-user system with 2k of memory. Using Windows, I dont think my situation has improved.
-
Aug 25th, 2009, 06:12 AM
#22
Re: Adding list in textbox without items.Add("")
-
Aug 25th, 2009, 06:30 AM
#23
Thread Starter
Lively Member
Re: [RESOLVED] Error:Comma,),Valid... Cant get to work
Thanks Bulldog,
Just one more question, how would I make a string because the paragraph is separate lines. Not just one string.
Thanks again.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|