i have created th contol as u said but all th news tha brought from the table are all before th image
the code i used to the control ( the user control contains a label and picturebox)
Quote:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication8
{
public partial class news_uc : UserControl
{
public news_uc()
{
InitializeComponent();
}
public string news_text
{
get { return news.Text; }
set { news.Text = value; Invalidate(); }
}
public Image img_news_delimetter
{
get { return img_delimetter.Image; }
set { img_delimetter.Image = value; Invalidate(); }
}
public string txt_news_delimetter
{
get { return text_delimiter.Text; }
set { text_delimiter.Text = value; Invalidate(); }
}
}
}
the code in the form
Quote:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication8
{
public partial class Form1 : Form
{
public SqlConnection fcon = new SqlConnection(@"Data Source=ME-PC\server;Initial Catalog=first_db;Integrated Security=True");
public SqlCommand cmd;
public SqlDataReader rdr;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Enabled = true;
}
void marquee(news_uc l)
{
if (l.Left > this.Width)
l.Left = 0;
else
l.Left = l.Left + 1;
}
private void timer1_Tick(object sender, EventArgs e)
{
marquee(news_uc1);
fill_news();
}
private void fill_news()
{
cmd = new SqlCommand("select * from news where is_activated=1 order by news_date", fcon);
if (fcon.State == ConnectionState.Open)
fcon.Close();
fcon.Open();
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
news_uc1.news_text += rdr[1].ToString();//
}
rdr.Close();
}
}
}
mmmmmmmmmmmm where is the problem >>> to repeat my img after each news
thanks again