[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.inetserver.asp.db

michael kors outlet if8

Katadedajab

12/27/2013 12:14:00 PM

<a href=http://www.synray.ca><b&... kors outlet canada</b></a>Such a multi functional using the article needs for more information regarding share to have everyone,a number of us can be capable of geting a lot of out of the ordinary harvest,let me give you including all we can in an instant can be bought to the stores for more information on get high-quality goods,we can save just how long. <a href=http://www.synray.ca><b&... kors outlet</b></a>Learn for more information about release and decide to put down,let the past pass, fighting also new tomorrow; it's really best to learn more about get acquainted with going to be the the right choice person all around the a good choice how much time but take heart we do nothing more than can have to worry about ourselves a lot better before that,rent it out going to be the nature take its course; Others in the event that be fighting more; It'll be the case fine! <a href=http://www.hummingbirdhollow.ca><b&... kors canada</b></a>Greetings! I are aware of that this is because somewhat off topic but I was wondering about whether or not all your family members knew where I could locate an all in one captcha plugin along with my very own comment form? I'm making use of their going to be the same your web business platform as yours and I'm having difficulty finding a minumum of one Thanks a multi functional chunk of property! <a href=http://www.synray.ca><b&... kors canada</b></a>Hey There. This is that often a multi functional really neatly written article. I will ensure that to bookmark it and come back running to learn more about learn a lot more including your useful information. Thanks and then for going to be the basically I will certainly come back running. <a href=http://www.electrolysis.ca><b&... kors handbags</b></a>
3 Answers

Tomasz J

9/20/2007 11:43:00 AM

0

Hello WenYuan,

I am sorry, I missed something. Please scratch out the previous post.

Here are the steps to reproduce the problem:

1. in the following order add new BindingSource to a new form,
2. add new BindingNavigator,
3. add new DataGridView,
4. add new TextBox,
5. set dataGridView1.DataSource to bindingSource1
6. set bindingNavigator1.BindingSource to bindingSource1
7. paste this code into form constructor:

DataTable dt = new DataTable();
dt.Columns.Add("test", typeof(string));
bindingSource1.DataSource = dt;
dataGridView1.AllowUserToAddRows = false;
dataGridView1.AllowUserToDeleteRows = false;
dataGridView1.AutoGenerateColumns = true;
textBox1.DataBindings.Add(new Binding("Text", bindingSource1, "test",
true));

8. Create bindingSource1 PositionChanged event handler and paste the
following code:

if (bindingSource1.Current == null) {
//dataGridView1.TabStop = false;
textBox1.Enabled = false;
} else {
//dataGridView1.TabStop = true;
textBox1.Enabled = true;
if (((DataRowView)bindingSource1.Current).IsNew) {
textBox1.Focus();
}
}

See what happens when you add and remove the first record using binding
navigator.

Commented out lines seem to remedy the problem - the best solution I found
so far.

Thank you,

Tomasz J



v-wywang

9/21/2007 9:10:00 AM

0

Hello Tomasz,
Thanks for your reply.

I have reproduced the issue on my side.

I'm afraid PositionChanged is not the right event for your requirement.

According to your description and Code, what you need is as following:
When there is no data in BindingSource, the textbox is disabled.
When there is any data in BindingSource, the textbox is enabled.
When we are adding data, the textbox should be focused.

Have you tried ListChanged event? This event will monitor the data in
BindingSource. We can check count and ListChangedTyped property to achieve
what you need.
This method works fine on my side. Would you please try it ?
void bindingSource1_ListChanged(object sender, ListChangedEventArgs e)
{
if (this.bindingSource1.Count == 0)
textBox1.Enabled = false;
else
textBox1.Enabled = true;

if (e.ListChangedType == ListChangedType.ItemAdded)
textBox1.Focus();
}

Hope this helps, please let me know if this way works fine on your side. We
are glad to assist you.
Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Tomasz J

9/23/2007 2:18:00 PM

0

Thank you WenYuan. I am not sure why, but your solution seems to work.
Tomas J