Hi,
I have a one textbox and one button..if i click the button it will display the email (retrieve the emails from sql database) in textbox..each 2 seconds email has been change in textbox till last email in database
XAML coding..
<Grid>
<TextBox Height="39" HorizontalAlignment="Left" Margin="183,65,0,0" Name="textBox1" VerticalAlignment="Top" Width="210" IsEnabled="False"/>
<Button Content="Button" Height="39" HorizontalAlignment="Left" Margin="439,54,0,0" Name="button1" VerticalAlignment="Top" Width="87" Click="button1_Click"
/>
</Grid>
C# coding...
using System.Windows.Threading;
private void button1_Click(object sender, RoutedEventArgs e)
{
con = new SqlConnection(cn);
con.Open();
SqlCommand cmdemail = new SqlCommand("gettomails", con);
cmdemail.CommandType = CommandType.StoredProcedure;
SqlDataReader drfromemail = cmdemail.ExecuteReader();
while (drfromemail.Read())
{
textBox1.Text = drfromemail["toemailid"].ToString();
DispatcherTimer dispatcherTimer = new DispatcherTimer();
//MessageBox.Show("");
dispatcherTimer.Interval = new TimeSpan(0, 0, 10);
dispatcherTimer.Start();
}
}