473,404 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Data binding to Rtf property of RichtTextBox problem

Hello!

I'm writing simple database application. One table in the database stores
some information about keywords (among other, keyword name, id number and
description). Description is stored in rtf format.

Following code is responsible for data binding (lstKeywords is
ListBox,rtbDescription is RichTextBox):

lstKeywords.DataSource = manager.KeywordsDataView;
lstKeywords.DisplayMember = "Name";
lstKeywords.ValueMember = "KeywordID";
rtbDescription.DataBindings.Add("Rtf", manager.KeywordsDataView,
"Description");

To avoid downloading all descriptions, at the beginning I fill only Name and
Id columns in table, and fill Description only when user selects appropriate
item in ListBox. Here is code:

DataRow[] rows = dsKeywords.Keywords.Select("KeywordID=" +
keywordId.ToString());
if ((rows.Length == 0) || ((int)rows[0]["Update"] == 1))
return;

cmdGetDescription.Parameters["@keywordId"].Value = keywordId;

try
{
sqlConnectionForCmds.Open();
object value = cmdGetDescription.ExecuteScalar();
if (value != DBNull.Value)
rows[0]["Description"] = (string)value;
else
rows[0]["Description"] = null;
rows[0]["Update"] = 1;
rows[0].AcceptChanges();
}
finally
{
sqlConnectionForCmds.Close();
}

This code is executed in event handler attached to
BindingContext[manager.KeywordsDataView].PositionChanged.

And now my problem: when I change selected item in list box, sometimes
"Description" column in my DataTable is also changed. Debugger shows that
something changes this column before even PositionChanged event is executed,
so I suppose this isn't my code responsible for it. I solved it by removing
line that binds RichTextBox to DataView, and manually updating data in
BindingContext[manager.KeywordsDataView].CurrentChanged event, but I still
don't now, if I did something wrong of it is .NET Framework bug. Does
anybody knows something about that?

Thanks in advance
Tomek

Nov 16 '05 #1
1 2796
Hello!

I should have checked Google first...
Answer is here:

http://www.eggheadcafe.com/ng/micros...post696084.asp

(RichTextBox doesn't have RtfChanged event)

Best regards
Tomek
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
6
by: Brad | last post by:
I have a web service which returns a collection of class object (see below). I want to consume this service in another web application by binding it to a List control The data returns from the...
4
by: Alan Silver | last post by:
Hello, I'm trying to use an ArrayList to do data binding, but am getting an error I don't understand. I posted this in another thread, but that was all confused with various other problems,...
19
by: Simon Verona | last post by:
I'm not sure if I'm going down the correct route... I have a class which exposes a number of properties of an object (in this case the object represents a customer). Can I then use this...
0
by: Larry Serflaten | last post by:
I am not sure how many are aware of this sort of data binding, but as it is new to many (classic) VB developers I thought I would post this once just to let people know of its availablility. ...
2
by: Matthias | last post by:
Hi Team this may be a newbie question. I have searched the discussions before posting: I'd like to re-use a form instance to edit record details. My data binding (a DataTable bound to...
2
by: David Veeneman | last post by:
I want to data bind a user control and a business object, using a BindingSource control. The control has a 'Priority' property that takes a 'Priority' enum (High, Normal, Low). The business object...
0
by: mjsterz | last post by:
I've been working with VB .NET for less than a year and this is the first time I've posted on one of these groups, so let me apologize beforehand if I'm being unclear, not posting my issue...
0
by: Charlie | last post by:
Hi: I get a TreeNode binding error when using Data property of XmlDataSource control. When I switch to TextFile property and point to xml file on hard drive, problem goes anyway. I'm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.