Operator '&' is not defined for types 'String' and 'System.Windows.Forms.TextBox'

This code snippet below gives me a warning underline on this piece of code  "CREATE DATABASE " & datasetnmTB.

The warning message is:
Operator '&' is not defined for types 'String' and 'System.Windows.Forms.TextBox'

I read through similar errors in the knowledge base but haven't been able to successfully overcome this.

Thank you.
Dim sql As String = "CREATE DATABASE " & datasetnmTB & " ON PRIMARY" + "(Name=test_data, filename = 'C:\program files\maximum insights - cleaner\dataset\mydb_data.mdf', size=3," + "maxsize=5, filegrowth=10%)log on" + "(name=mydbb_log, filename='C:\program files\maximum insights - cleaner\dataset\" & datasetnmTB & "_log.ldf',size=3," + "maxsize=20,filegrowth=1)"

Open in new window

LVL 1
adamchicagoAsked:
Who is Participating?
 
käµfm³d 👽Connect With a Mentor Commented:
You have to access the Text property of a TextBox in order to get its value.
Dim sql As String = "CREATE DATABASE " & datasetnmTB.Text & " ON PRIMARY" + "(Name=test_data, filename = 'C:\program files\maximum insights - cleaner\dataset\mydb_data.mdf', size=3," + "maxsize=5, filegrowth=10%)log on" + "(name=mydbb_log, filename='C:\program files\maximum insights - cleaner\dataset\" & datasetnmTB.Text & "_log.ldf',size=3," + "maxsize=20,filegrowth=1)"

Open in new window

0
 
adamchicagoAuthor Commented:
Well that did it....it seems so simple.  I know Excel VBA really well but am still getting up to speed in VB.Net.

Thanks again!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.