I have a Question on the Limits on numericUpDown (Help Please)

Is it posssible to get a numericrUpDown to write Text to TextBox Example: 1,2,3,4,5 in the numericUpDown would write this to a TextBox:

"border:1px;

border:2px;

border:3px;

border:4px; etc " and follow the format ..

if so can some give me an example of it would be done,cause i'm not sure how to get it to do what i need...lol

Thxs for the Help in Advance!!



Answer this question

I have a Question on the Limits on numericUpDown (Help Please)

  • Ian Cook

    cssTextBox.Text = string.Format("border:{0}px;", numericUpDown1.Value );



  • Matt E.

    Blair's code will work because I said to hook the code up to the value changed event, you said 'yes', but obviously you're not hooking the code up to that event at all. If you were, then it would work.



  • Ronald L

    if I pasted my code right it would work :


    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    namespace MyApp
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }
    protected override void OnLoad(EventArgs e)
    {
    base.OnLoad(e);
    numericUpDown1.ValueChanged += numericUpDown1_ValueChanged;
    numericUpDown1.Value = 8;
    }
    private void numericUpDown1_ValueChanged(object sender,
    EventArgs e)
    {
    textBox1.Text = string.Format("border: {0}px",
    numericUpDown1.Value.ToString());
    }
    }
    }



  • Danilo80

    The numeric up down will have an event for when it's value changes. You can catch this event and use it to write a value to a textbox.



  • Stretchcoder

    I put in the code you typed in...Thing is even when i change the numeric value of that box..Its not writing to the cssTextBox...
  • Gabriel Lozano-Moran

    yeah but how this is what i have so far::

    cssTextBox.Text = (numericUpDown1.Value = Convert.ChangeType(object numericUpDown1, Type Text);

    I think i'm on the right track but than again i'm not sure..lol


  • I have a Question on the Limits on numericUpDown (Help Please)