Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

RichTextBox Control  population

Posted on 2014-03-24
3
Medium Priority
?
306 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

722 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