Solved

RichTextBox Control  population

Posted on 2014-03-24
3
302 Views
Last Modified: 2014-03-25
How do you place a null  into a RichTextBox control?
0
Comment
Question by:metro156
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40
ID: 39952235
Define what you see as a null. A database null or a code null? A null character or a completely empty RichTextBox? And what language are you using, VB or C#?

If you mean to empty the RTB, then the following should do it:

RichTextBox1.Text = Nothing ' VB
RichTextBox1.Text = null; // C#

But depending on the use, since Text is a string, and since a string can both be empty and have a value of String.Empty, it might not be considered as null, depending on how you use it.

Please, give more information about what you mean by "a  null  into a RichTextBox control", as well as how you intend to use this value, and we should be able to give you a more precise answer.
0
 

Author Comment

by:metro156
ID: 39952855
I need to put a null value into a column of a sql server database table via the RichTextBox.


Using C#.
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 39953166
How do you send your update to the server?

To send a null value to the server, you need to use DBNull.Value, which cannot be stored in a RichTextBox because it cannot be converted to a String.

Thus the null cannot come directly from the control. You will have to detect the fact that the control is empty and send a DBNull.Value instead to the database.

An alternative is not to accept null in the database, and consider an empty string as your null value for that field.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question