Skip to content

How to make my own component library?

dofmcp

Asked Mar 11, 2005, 8:58 AM EST3 answers
Share
LinkedInX
12/03/2005 Hariom (a word to wish) All, I wish to create my own components and their own properties and events. Say a text box containing a property named "type" must contain two options 1) IsNumeric 2) AlphaNumeric. If I select "IsNumeric", it should not allow other than digits only. If anybody could help me the coding part, please do. Thanx in advance. Abhishek Maitrey

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hi, Question1: I wish to create my own components and their own properties and events. Answer1: Create a windows control library that extends from System.Windows.Forms.TextBox Question2: If I select "IsNumeric", it should not allow other than digits only. Answer2: There are 2 ways to achieve this. You can do this: bool isNumeric(char character) { if (character >= '0' && character <= '9') return true; else return false; } or use regular expression using System.Text.RegularExpressions; private bool isNumeric(string subject) { return(Regex.IsMatch(subject,"^[-0-9]*.[.0-9].[0-9]*$")); } Hope to get you started somewhere.
    0
  • 0
    Once again!!! Solutions for VB.Net should written in VB.Net! That's what this group os all about. Answer to 2 in VB.Net: public function isNumeric(byval character as Char) as Boolean return (character >= "0" and character <= "9") end function for regex: imports System.Text.RegularExpressions private function isNumeric(byval subject as String) as boolean return(Regex.IsMatch(subject,"^[-0-9]*.[.0-9].[0-9]*$")) end function
    0
  • 0
    Hi, Once again!!! Solutions for VB.Net should written in VB.Net! That's what this group os all about. --> Sorry, coz i am able to simulate using notepad as i am not at home. I not a vb coder, so i need vs.net to code it. Again, my fault. Sorry!
    0