9 Replies - 1438 Views - Last Post: 13 October 2012 - 03:30 AM Rate Topic: -----

#1 voice.of.silence  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 11-October 12

creating class to control TextBox

Posted 11 October 2012 - 01:42 AM

Hello to all :
I am new C# programmer and I have problem to create a class .
Here I have problem to create class to control TextBoxex.
for example to control the number or letter , date or ... . which , I can use in all my projects.
Unfortunetly I have problem to write its method .
I would be very happy if you can help me to write this class.
Voice of Silence
Is This A Good Question/Topic? 0
  • +

Replies To: creating class to control TextBox

#2 janne_panne  Icon User is offline

  • WinRT Dev
  • member icon

Reputation: 429
  • View blog
  • Posts: 1,047
  • Joined: 09-June 09

Re: creating class to control TextBox

Posted 11 October 2012 - 01:48 AM

What is your problem at writing it?
Was This Post Helpful? 0
  • +
  • -

#3 voice.of.silence  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 11-October 12

Re: creating class to control TextBox

Posted 11 October 2012 - 03:16 AM

View Postjanne_panne, on 11 October 2012 - 01:48 AM, said:

What is your problem at writing it?





As I am starter I dont know how to write a method to control that just we can insert a number.
I need an example to know how to write it.
Regards
Was This Post Helpful? 0
  • +
  • -

#4 Michael26  Icon User is online

  • DIC-head, major DIC-head
  • member icon

Reputation: 349
  • View blog
  • Posts: 1,506
  • Joined: 08-April 09

Re: creating class to control TextBox

Posted 11 October 2012 - 03:36 AM

This sounds like you need to learn about Events and also Here(events on D.I.C )

Also don't forget to review Methods

This post has been edited by Michael26: 11 October 2012 - 03:38 AM

Was This Post Helpful? 0
  • +
  • -

#5 voice.of.silence  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 11-October 12

Re: creating class to control TextBox

Posted 11 October 2012 - 03:49 AM

View PostMichael26, on 11 October 2012 - 03:36 AM, said:

This sounds like you need to learn about Events and also Here(events on D.I.C )

Also don't forget to review Methods





Yes, I am agree with you that I have to review.
I can work with events when I write an event for a user control but my main problem is that I can not use them in a class.
Was This Post Helpful? 0
  • +
  • -

#6 Curtis Rutland  Icon User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4437
  • View blog
  • Posts: 7,710
  • Joined: 08-June 10

Re: creating class to control TextBox

Posted 11 October 2012 - 06:53 AM

I still have literally no idea what you want here. You want a class to "control" a text box? Please spell out in detail what you're trying to do. Because if you're trying to do what I think, there's already a control that does what you want, called the MaskedTextBox.
Was This Post Helpful? 0
  • +
  • -

#7 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3477
  • View blog
  • Posts: 10,723
  • Joined: 05-May 12

Re: creating class to control TextBox

Posted 11 October 2012 - 07:09 AM

View Postvoice.of.silence, on 11 October 2012 - 03:49 AM, said:

Yes, I am agree with you that I have to review.
I can work with events when I write an event for a user control but my main problem is that I can not use them in a class.


Can you explain why you cannot use an event in a class? Is there some kind of design constraint that you are working with?
Was This Post Helpful? 0
  • +
  • -

#8 Michael26  Icon User is online

  • DIC-head, major DIC-head
  • member icon

Reputation: 349
  • View blog
  • Posts: 1,506
  • Joined: 08-April 09

Re: creating class to control TextBox

Posted 11 October 2012 - 08:12 AM

I guess he didn't read the msdn article on events.
Was This Post Helpful? 0
  • +
  • -

#9 tlhIn`toq  Icon User is online

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5436
  • View blog
  • Posts: 11,663
  • Joined: 02-June 10

Re: creating class to control TextBox

Posted 11 October 2012 - 01:32 PM

Quote

for example to control the number or letter , date or ... . which , I can use in all my projects.


I think what you are really talking about is inheritance.
If you want to make a textbox that can only have 12 characters entered, or a textbox that can only have numbers entered... Is that the kind of 'control' you're talking about?

What you do is make a new class that has inherited from TextBox then add code to give it the behavior you want. Do a google for "MSDN numeric textbox" and that will give you a link to a tutorial for building an inherited textbox with custom behavior
Was This Post Helpful? 0
  • +
  • -

#10 voice.of.silence  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 11-October 12

Re: creating class to control TextBox

Posted 13 October 2012 - 03:30 AM

Hi. Thank you very much. I eventually write a class to control textbox to control input text.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1