Solved

RichTextBox Control  population

Posted on 2014-03-24
3
286 Views
Last Modified: 2014-03-25
How do you place a null  into a RichTextBox control?
0
Comment
Question by:metro156
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now