Click here to Skip to main content
15,884,298 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Add Multiple Records to one TextBox from SQL Pin
Richard MacCutchan3-Apr-14 0:07
mveRichard MacCutchan3-Apr-14 0:07 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Dan O'Riordan3-Apr-14 0:15
Dan O'Riordan3-Apr-14 0:15 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Richard MacCutchan3-Apr-14 0:22
mveRichard MacCutchan3-Apr-14 0:22 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Dan O'Riordan3-Apr-14 0:26
Dan O'Riordan3-Apr-14 0:26 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Richard MacCutchan3-Apr-14 0:31
mveRichard MacCutchan3-Apr-14 0:31 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Dan O'Riordan3-Apr-14 0:38
Dan O'Riordan3-Apr-14 0:38 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Richard Deeming3-Apr-14 0:55
mveRichard Deeming3-Apr-14 0:55 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Dan O'Riordan3-Apr-14 1:03
Dan O'Riordan3-Apr-14 1:03 
Hi Richard,

I did mate:

Calls the Data from the DQL Database:

VB
Dim con As SqlConnection = New SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=FigClubs;Integrated Security=True;Pooling=False")

Dim cmd As SqlCommand = New SqlCommand("SELECT Email FROM Members", con)

con.Open()

Dim myDA As SqlDataAdapter = New SqlDataAdapter(cmd)

Dim myDataTable As DataTable = New DataTable

myDA.Fill(myDataTable)

con.Close()

con = Nothing


This tells the data to display in the TextBox:

VB
Try
      Dim Smtp_Server As New SmtpClient
      Dim e_mail As New MailMessage()
      Smtp_Server.UseDefaultCredentials = False
      Smtp_Server.Credentials = New Net.NetworkCredential(My.Settings.ClubEmail, My.Settings.EmailPassword)
      Smtp_Server.Port = 587
      Smtp_Server.EnableSsl = True
      Smtp_Server.Host = "smtp.gmail.com"

      e_mail = New MailMessage()
      e_mail.From = New MailAddress(TextBox4.Text)
      e_mail.To.Add(EmailTextBox.Text)
      e_mail.Subject = TextBox1.Text
      e_mail.IsBodyHtml = False
      e_mail.Body = TextBox2.Text
      Smtp_Server.Send(e_mail)
      MsgBox("Your email has been sent.")

  Catch error_t As Exception
      MsgBox(error_t.ToString)
  End Try


It obviously works because one of the emails in the Database is displayed in the TextBox in question and the email is sent without error to this address.
The TextBox for the To: field is bound to the Datatable called Members. In SQL this data has a field called "Email, where I am getting the email addresses from and displaying them into the TextBox.

VB
Me.MembersTableAdapter.Fill(Me.MembersDataSet.Members)


Can you tell me please how to loop it and separate them with Commas? I have searched everywhere for a solution and not getting anywhere.

Thanks.
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Richard Deeming3-Apr-14 1:14
mveRichard Deeming3-Apr-14 1:14 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Dan O'Riordan3-Apr-14 1:23
Dan O'Riordan3-Apr-14 1:23 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Richard MacCutchan3-Apr-14 1:12
mveRichard MacCutchan3-Apr-14 1:12 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Dave Kreskowiak3-Apr-14 2:24
mveDave Kreskowiak3-Apr-14 2:24 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Dan O'Riordan3-Apr-14 2:43
Dan O'Riordan3-Apr-14 2:43 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Dave Kreskowiak3-Apr-14 3:43
mveDave Kreskowiak3-Apr-14 3:43 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Richard MacCutchan3-Apr-14 4:00
mveRichard MacCutchan3-Apr-14 4:00 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Dan O'Riordan3-Apr-14 2:52
Dan O'Riordan3-Apr-14 2:52 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Richard MacCutchan3-Apr-14 3:11
mveRichard MacCutchan3-Apr-14 3:11 
AnswerRe: Add Multiple Records to one TextBox from SQL Pin
Tino Fourie24-Apr-14 4:13
Tino Fourie24-Apr-14 4:13 
QuestionMinimize 3 forms pressing the minimize button on main form Pin
dilkonika2-Apr-14 1:42
dilkonika2-Apr-14 1:42 
AnswerRe: Minimize 3 forms pressing the minimize button on main form Pin
Richard MacCutchan2-Apr-14 2:31
mveRichard MacCutchan2-Apr-14 2:31 
GeneralRe: Minimize 3 forms pressing the minimize button on main form Pin
dilkonika2-Apr-14 3:37
dilkonika2-Apr-14 3:37 
GeneralRe: Minimize 3 forms pressing the minimize button on main form Pin
Dave Kreskowiak2-Apr-14 3:54
mveDave Kreskowiak2-Apr-14 3:54 
GeneralRe: Minimize 3 forms pressing the minimize button on main form Pin
dilkonika2-Apr-14 3:58
dilkonika2-Apr-14 3:58 
AnswerRe: Minimize 3 forms pressing the minimize button on main form Pin
Dave Kreskowiak2-Apr-14 4:12
mveDave Kreskowiak2-Apr-14 4:12 
GeneralRe: Minimize 3 forms pressing the minimize button on main form Pin
dilkonika2-Apr-14 6:07
dilkonika2-Apr-14 6:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.