Click here to Skip to main content
15,914,074 members
Home / Discussions / C#
   

C#

 
AnswerRe: CRTP in c#/.NET? Pin
Gerry Schmitz7-Mar-19 7:26
mveGerry Schmitz7-Mar-19 7:26 
GeneralRe: CRTP in c#/.NET? Pin
BillWoodruff8-Mar-19 17:16
professionalBillWoodruff8-Mar-19 17:16 
GeneralRe: CRTP in c#/.NET? Pin
pr1mem0ver11-Mar-19 16:55
pr1mem0ver11-Mar-19 16:55 
QuestionOnly Numeric Textbox ( Back Space is working ) Pin
Bayram Demirci6-Mar-19 1:31
Bayram Demirci6-Mar-19 1:31 
AnswerRe: Only numeric ( Back Space is working also ) Pin
OriginalGriff6-Mar-19 1:58
mveOriginalGriff6-Mar-19 1:58 
GeneralRe: Only numeric ( Back Space is working also ) Pin
Bayram Demirci6-Mar-19 2:32
Bayram Demirci6-Mar-19 2:32 
GeneralRe: Only numeric ( Back Space is working also ) Pin
OriginalGriff6-Mar-19 2:47
mveOriginalGriff6-Mar-19 2:47 
GeneralRe: Only numeric ( Back Space is working also ) Pin
pr1mem0ver6-Mar-19 13:29
pr1mem0ver6-Mar-19 13:29 
GeneralRe: Only numeric ( Back Space is working also ) Pin
Eddy Vluggen7-Mar-19 1:03
professionalEddy Vluggen7-Mar-19 1:03 
GeneralRe: Only numeric ( Back Space is working also ) Pin
pr1mem0ver7-Mar-19 4:54
pr1mem0ver7-Mar-19 4:54 
GeneralRe: Only numeric ( Back Space is working also ) Pin
Eddy Vluggen7-Mar-19 9:51
professionalEddy Vluggen7-Mar-19 9:51 
GeneralRe: Only numeric ( Back Space is working also ) Pin
BillWoodruff8-Mar-19 23:20
professionalBillWoodruff8-Mar-19 23:20 
AnswerRe: Only numeric ( Back Space is working also ) Pin
Dave Kreskowiak6-Mar-19 2:23
mveDave Kreskowiak6-Mar-19 2:23 
GeneralRe: Only numeric ( Back Space is working also ) Pin
Bayram Demirci6-Mar-19 2:56
Bayram Demirci6-Mar-19 2:56 
GeneralRe: Only numeric ( Back Space is working also ) Pin
Dave Kreskowiak6-Mar-19 5:49
mveDave Kreskowiak6-Mar-19 5:49 
GeneralRe: Only numeric ( Back Space is working also ) Pin
BillWoodruff8-Mar-19 22:55
professionalBillWoodruff8-Mar-19 22:55 
AnswerRe: Only Numeric Textbox ( Back Space is working ) Pin
Gerry Schmitz6-Mar-19 4:30
mveGerry Schmitz6-Mar-19 4:30 
AnswerRe: Only Numeric Textbox ( Back Space is working ) Pin
qA-Cp24-Mar-19 23:27
qA-Cp24-Mar-19 23:27 
namespace CustomControls
{
    public enum NumModel
    {
        /// <summary>
        /// 
        /// </summary>
        PositiveInteger,
        /// <summary>
        /// 
        /// </summary>
        PositiveFloat
    }
    public class NumberTextBox : TextBox
    {
        private NumModel numModel = NumModel.PositiveInteger;
        /// <summary>
        /// 
        /// </summary>
        public NumModel NumModel
        {
            get
            {
                return numModel;
            }
            set
            {
                numModel = value;
            }
        }

        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            if ((e.KeyChar >= '0' && e.KeyChar <= '9') || (e.KeyChar == 8) || (e.KeyChar == 46))
            {
                if (numModel == NumModel.PositiveInteger)
                {
                    if ((e.KeyChar == 46))
                    {
                        e.Handled = true;
                    }
                    else
                    {
                        e.Handled = false;
                        //base.OnKeyPress(e);
                    }
                }
                else
                {
                    if ((this.Text.Contains(".") && (e.KeyChar == 46)))
                    {
                        e.Handled = true;
                    }
                    else
                    {
                        e.Handled = false;
                        // base.OnKeyPress(e);
                    }
                }
            }
            else
            {

                e.Handled = true;
            }
        }
        protected override void OnKeyUp(KeyEventArgs e)
        {
            double num;
            if (this.Text != null && this.Text != "" && !double.TryParse(this.Text, out num))
            {
                //SendKeys.Send("{Backspace}");
                this.Text = this.Text.Substring(0, this.Text.Length - 1);
                this.Select(this.Text.Length, 0);
            }
            base.OnKeyUp(e);
        }
    }
}

QuestionEfficient way of updating items Pin
Danpeking6-Mar-19 0:41
Danpeking6-Mar-19 0:41 
AnswerRe: Efficient way of updating items Pin
OriginalGriff6-Mar-19 1:01
mveOriginalGriff6-Mar-19 1:01 
AnswerRe: Efficient way of updating items Pin
F-ES Sitecore6-Mar-19 2:35
professionalF-ES Sitecore6-Mar-19 2:35 
AnswerRe: Efficient way of updating items Pin
Gerry Schmitz6-Mar-19 4:24
mveGerry Schmitz6-Mar-19 4:24 
QuestionVS 2017 c# Getting Current Version number Pin
ormonds5-Mar-19 16:52
ormonds5-Mar-19 16:52 
AnswerRe: VS 2017 c# Getting Current Version number Pin
OriginalGriff5-Mar-19 20:04
mveOriginalGriff5-Mar-19 20:04 
GeneralRe: VS 2017 c# Getting Current Version number Pin
ormonds6-Mar-19 17:54
ormonds6-Mar-19 17:54 

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.