private void TextBoxAutomaticShoutouts_TextChanged(object sender, EventArgs e) { TextBox tb = (TextBox)sender; if (!tb.Focused) { return; } var mlc = new MaxLengthChecker(); if (mlc.GetMaxLength(textBoxAutomaticShoutouts.Text, 60)) { textBoxAutomaticShoutouts.MaxLength = textBoxAutomaticShoutouts.Text.Length; } }
private void TextBoxPreviousOwner_TextChanged(object sender, EventArgs e) { TextBox tb = (TextBox)sender; if (!tb.Focused) { return; } var mlc = new MaxLengthChecker(); if (mlc.GetMaxLength(textBoxPreviousOwner.Text, 32)) { textBoxPreviousOwner.MaxLength = textBoxPreviousOwner.Text.Length; } }
public override void Interpret(ColumnResolveContext context) { Regex regex = new Regex(@"<If_HasMaxLength>(?<template>((?!</EndIf>).|\n)*)</EndIf>", RegexOptions.IgnoreCase | RegexOptions.Compiled); Match match = regex.Match(context.Output); string template = match.Groups["template"].Value; MaxLengthChecker checker = new MaxLengthChecker(); MaxLengthReplacer replacer = new MaxLengthReplacer(); checker.SetSuccessor(replacer); string replaceStr = checker.Resolve(template, context.Column.DbType, context.Column.TotalBit); context.Output = regex.Replace(context.Output, replaceStr); }