VB.net -Create a simple ticker using a label


SUBMITTED BY: TheSwarm

DATE: Oct. 20, 2015, 8:41 p.m.

FORMAT: Text only

SIZE: 593 Bytes

HITS: 2170

  1. // Designer
  2. this.label1 = new System.Windows.Forms.Label();
  3. this.label1.Location = new System.Drawing.Point(0, 0);
  4. this.label1.Name = "label1";
  5. this.label1.Text = "Hello World!";
  6. private void Form1_Load(object sender, System.EventArgs e)
  7. {
  8. Timer t1 = new Timer();
  9. t1.Interval = 20;
  10. t1.Tick+=new EventHandler(t1_Tick);
  11. t1.Start();
  12. }
  13. private void t1_Tick(object sender, EventArgs e)
  14. {
  15. int i;
  16. i = label1.Location.X;
  17. if (i >= this.Width)
  18. i = 0;
  19. else
  20. i = label1.Location.X + 1;
  21. label1.Location = new Point(i,0);
  22. }

comments powered by Disqus