Click here to Skip to main content
15,886,519 members
Home / Discussions / Visual Basic
   

Visual Basic

 
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 
GeneralRe: Add Multiple Records to one TextBox from SQL Pin
Richard Deeming3-Apr-14 1:14
mveRichard Deeming3-Apr-14 1:14 
So you're using data-binding to move the data from the DataTable to the TextBox? That's not going to work; a TextBox will only bind to a single record.

You can either remove the binding and loop through the values in code:
C#
string[] addresses myDataTable.Rows.Cast<DataRow>().Select(row => (string)row[0]).ToArray();
EmailTextBox.Text = string.Join(", ", addresses);


Or you can change the query to return a single row with the concatenated addresses in it, using one of these methods[^]:
SQL
SELECT Stuff((SELECT ', ' + Email FROM Members FOR XML PATH(''), TYPE).value('.', 'varchar(max)'), 1, 2, '') As Email;




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


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 
SuggestionRe: Minimize 3 forms pressing the minimize button on main form Pin
Eddy Vluggen2-Apr-14 7:06
professionalEddy Vluggen2-Apr-14 7:06 

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.