From accessd at shaw.ca Sat Mar 1 18:40:23 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Sat, 01 Mar 2008 16:40:23 -0800 Subject: [dba-VB] OT ASP nightmare In-Reply-To: References: Message-ID: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. From ebarro at verizon.net Mon Mar 3 18:52:44 2008 From: ebarro at verizon.net (Eric Barro) Date: Mon, 03 Mar 2008 16:52:44 -0800 Subject: [dba-VB] OT ASP nightmare In-Reply-To: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> Message-ID: <0JX6007N0KZ9CB05@vms173003.mailsrvcs.net> Jim, Does this just affect classic ASP stuff and not .NET stuff? Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Saturday, March 01, 2008 4:40 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] OT ASP nightmare I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From accessd at shaw.ca Mon Mar 3 23:45:40 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 03 Mar 2008 21:45:40 -0800 Subject: [dba-VB] OT ASP nightmare In-Reply-To: <0JX6007N0KZ9CB05@vms173003.mailsrvcs.net> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> <0JX6007N0KZ9CB05@vms173003.mailsrvcs.net> Message-ID: Hi Eric: It appears to affect both. Dot Net apps do not seem to run correctly and classic ASP apps do not run at all. Jim -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Eric Barro Sent: Monday, March 03, 2008 4:53 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] OT ASP nightmare Jim, Does this just affect classic ASP stuff and not .NET stuff? Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Saturday, March 01, 2008 4:40 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] OT ASP nightmare I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From accessd at shaw.ca Fri Mar 7 00:50:10 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 06 Mar 2008 22:50:10 -0800 Subject: [dba-VB] [dba-Tech] Good article In-Reply-To: <00e501c876f8$33261580$4b3a8343@SusanOne> References: <00e501c876f8$33261580$4b3a8343@SusanOne> Message-ID: <09F142CA44F04AD1AB07B83674900027@creativesystemdesigns.com> Hi All: Some new entries to current events have been added to the DBA web site (http://www.databaseadvisors.com). Both Arthur Fuller, Martin Reid have new articles out and even John Colby's database is now famous by reference. If you are a student or know one, the DreamSpark program from Microsoft is worthy of pursing. Jim From michael at ddisolutions.com.au Tue Mar 11 01:58:55 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Tue, 11 Mar 2008 17:58:55 +1100 Subject: [dba-VB] OT ASP nightmare References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local> Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M From michael at ddisolutions.com.au Tue Mar 11 03:38:11 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Tue, 11 Mar 2008 19:38:11 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> <59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From accessd at shaw.ca Tue Mar 11 15:42:19 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Tue, 11 Mar 2008 13:42:19 -0700 Subject: [dba-VB] OT ASP nightmare In-Reply-To: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> Message-ID: <058D9D08178446ABB47A1958A1093798@creativesystemdesigns.com> To all those who have been wondering what the problem was and the solution to that problem is, 4 hours on the phone to Microsoft finally created a solution. There have only been 14 cases similar to this, so I feel honoured. The solution was to go into the registries to the HKEY_CLASSES_ROOT (HKCR) and set the LOCAL SYSTEM account to have FULL control and USERS group (or authenticated users) to have READ permissions. Somehow some program... an MS update most likely changed the registry permissions. ASP can still not connect to the SQL servers but another specialist will be calling soon in the on going saga. Jim -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Saturday, March 01, 2008 4:40 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] OT ASP nightmare I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From michael at ddisolutions.com.au Thu Mar 13 01:17:22 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Thu, 13 Mar 2008 17:17:22 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Thu Mar 13 02:43:40 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Thu, 13 Mar 2008 08:43:40 +0100 Subject: [dba-VB] Data Binding values from code Message-ID: Hi Michael I doubt that - though I have no idea of how. And I guess you had other things to deal with and moved on after having done some research and experimenting ... /gustav >>> michael at ddisolutions.com.au 13-03-2008 07:17 >>> And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Thu Mar 13 10:04:15 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 13 Mar 2008 08:04:15 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> Message-ID: Since you didn't post any code, just referred to dataset, bindingsource and tableadaptor, your chances of getting a definitive answer are low. There are so many ways to do things in dot net that a general question can either elicit an avalanche of different methods or no answer at all. Is the control bound to a field or unbound? Have you looked into BindingContext? Without seeing the code you're using, it's pretty difficult to do more than say "here's how *I* do it", and that doesn't help if *I* am not using the same combination of objects that you are. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Thu Mar 13 10:19:32 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 13 Mar 2008 08:19:32 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> Message-ID: By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From michael at ddisolutions.com.au Thu Mar 13 17:50:01 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Fri, 14 Mar 2008 09:50:01 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Thu Mar 13 19:34:32 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 13 Mar 2008 17:34:32 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> Message-ID: I haven't waded through your code (I write VB.Net, so it's more work to read yours), but I noticed you're setting the Text property of the control. Why that instead of the Value property? I have seen instances when it made a difference. It's perfectly possible in my experience to set the text of a control without triggering the form's or the control's validation. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 3:50 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From michael at ddisolutions.com.au Thu Mar 13 20:22:01 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Fri, 14 Mar 2008 12:22:01 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3D2@ddi-01.DDI.local> Thanks Charlotte, VB.net has a TextBox.Value property? There is no equivalent property in C#. IIRC Access has both and it did make a difference. cheers Michael M I haven't waded through your code (I write VB.Net, so it's more work to read yours), but I noticed you're setting the Text property of the control. Why that instead of the Value property? I have seen instances when it made a difference. It's perfectly possible in my experience to set the text of a control without triggering the form's or the control's validation. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 3:50 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Fri Mar 14 10:29:40 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Fri, 14 Mar 2008 08:29:40 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3D2@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3D2@ddi-01.DDI.local> Message-ID: The CONTROL has a value property. It doesn't really make sense that there would be a difference in C# if you're using Windows controls. A textbox can hold more than text and if you wanted to apply numeric formats, they would apply to the value, which would be numeric, not to the text, which would be a string. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 6:22 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Thanks Charlotte, VB.net has a TextBox.Value property? There is no equivalent property in C#. IIRC Access has both and it did make a difference. cheers Michael M I haven't waded through your code (I write VB.Net, so it's more work to read yours), but I noticed you're setting the Text property of the control. Why that instead of the Value property? I have seen instances when it made a difference. It's perfectly possible in my experience to set the text of a control without triggering the form's or the control's validation. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 3:50 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 09:55:52 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 15:55:52 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventargs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From jwcolby at colbyconsulting.com Tue Mar 25 10:03:13 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 11:03:13 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: Message-ID: <008e01c88e89$59b7a350$0201a8c0@M90> Oh I know. Waving hand wildly in the air. Use Mid(). I just couldn't resist. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Tue Mar 25 10:11:30 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 11:11:30 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: Message-ID: <008f01c88e8a$81a78690$0201a8c0@M90> I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 10:49:23 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 16:49:23 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi John Don't hide. Even Mid(something) would be nicer than '\b' ...! /gustav >>> jwcolby at colbyconsulting.com 25-03-2008 16:03 >>> Oh I know. Waving hand wildly in the air. Use Mid(). I just couldn't resist. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From jwcolby at colbyconsulting.com Tue Mar 25 11:03:00 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 12:03:00 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: Message-ID: <009701c88e91$b3701b90$0201a8c0@M90> Yea, it reminds me of the old days when you had an ascii chart taped to the wall. Back in the day I could tell you from memory the ascii code for the space, cr, lf etc. Numbers were easy, upper and lower case not so easy, and I was always looking up the special characters. Of course REAL men don't need no steenkin ASCII chart either. ;-) John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 11:49 AM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi John Don't hide. Even Mid(something) would be nicer than '\b' ...! /gustav >>> jwcolby at colbyconsulting.com 25-03-2008 16:03 >>> Oh I know. Waving hand wildly in the air. Use Mid(). I just couldn't resist. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 11:53:09 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 19:53:09 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000501c88e98$b4a64d70$6401a8c0@nant> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 12:04:40 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 20:04:40 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: <008f01c88e8a$81a78690$0201a8c0@M90> Message-ID: <000901c88e9a$50979bc0$6401a8c0@nant> Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com From cfoust at infostatsystems.com Tue Mar 25 12:14:37 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 10:14:37 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000501c88e98$b4a64d70$6401a8c0@nant> References: <000501c88e98$b4a64d70$6401a8c0@nant> Message-ID: Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypressev enta rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Tue Mar 25 12:27:15 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 13:27:15 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000901c88e9a$50979bc0$6401a8c0@nant> References: <008f01c88e8a$81a78690$0201a8c0@M90> <000901c88e9a$50979bc0$6401a8c0@nant> Message-ID: <00a301c88e9d$78573550$0201a8c0@M90> And of course the real question is, why do you have to buy such a basic tool from a third party? That kind of stuff has been available from VBA for how many years? John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:05 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 12:57:25 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 20:57:25 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: <00a301c88e9d$78573550$0201a8c0@M90> Message-ID: <000c01c88ea1$af4d80b0$6401a8c0@nant> John, I think I have the answer :) - MS makes development tools first of all for themselves, and it is well known that only real men are working there at MS :) IOW they do not need such development support tools.... They let third-party tools to mature, and the authors of these tools to make some good money, then when MS sees that such third-party tools are highly demanded by market and can bring them good profits if they will own, polish and develop/extend them further, then they (MS) buy them with all their real stuff & staff, fire the "ballast" stuff & staff, or "kill" them completely by making similar tools from scratch... This way they (MS) save some (big) bucks on R&D... http://www.insearchofstupidity.com/ That's a real(?) monopolistic capitalism in action... LOL -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 8:27 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# And of course the real question is, why do you have to buy such a basic tool from a third party? That kind of stuff has been available from VBA for how many years? John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:05 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ From Gustav at cactus.dk Tue Mar 25 13:12:12 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 19:12:12 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventargs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From jwcolby at colbyconsulting.com Tue Mar 25 13:20:37 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 14:20:37 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000c01c88ea1$af4d80b0$6401a8c0@nant> References: <00a301c88e9d$78573550$0201a8c0@M90> <000c01c88ea1$af4d80b0$6401a8c0@nant> Message-ID: <00a501c88ea4$ed161fd0$0201a8c0@M90> And of course all aggravated by "sql server gurus" who execute code through the command prompt. I need (and am building) a "quick and dirty" script to execute about 20-30 various queries, exports to csv, imports from csvs etc to take an order for data and turn it into a csv for shipment. I need that because it takes a half a day of executing crap by hand to fill an order that should take 5 minutes of my time to specify. I have exactly two things I need to do to specify an order, enter a "number of records to export" and modify an existing view in a template database to pull the right set of data. Sometimes I have to do a few more things, but even then it is about 1/2 hour of real work. The rest of my time is executing queries, one by one, waiting for the results to be ready to run the next. In the end I am writing a .Net application that stores everything in metadata tables but that takes time to design and debug. However the time will be well worthwhile if I can fill an order in 5 minutes that takes me a half day to do by hand. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:57 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# John, I think I have the answer :) - MS makes development tools first of all for themselves, and it is well known that only real men are working there at MS :) IOW they do not need such development support tools.... They let third-party tools to mature, and the authors of these tools to make some good money, then when MS sees that such third-party tools are highly demanded by market and can bring them good profits if they will own, polish and develop/extend them further, then they (MS) buy them with all their real stuff & staff, fire the "ballast" stuff & staff, or "kill" them completely by making similar tools from scratch... This way they (MS) save some (big) bucks on R&D... http://www.insearchofstupidity.com/ That's a real(?) monopolistic capitalism in action... LOL -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 8:27 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# And of course the real question is, why do you have to buy such a basic tool from a third party? That kind of stuff has been available from VBA for how many years? John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:05 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 13:30:34 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 21:30:34 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000d01c88ea6$50c87950$6401a8c0@nant> Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypressev enta rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 13:39:50 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 21:39:50 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000e01c88ea7$9c661ec0$6401a8c0@nant> <<< Visual Studio shines. >>> Yes, and Microsoft.VisualBasic assembly will hopefully always be natural part of .NET Framework... But I wonder why do you still use that much code lines in your function? Isn't that good enough? private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } Am I missing something? Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 13:59:04 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 19:59:04 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav >>> shamil at users.mns.ru 25-03-2008 19:39 >>> <<< Visual Studio shines. >>> Yes, and Microsoft.VisualBasic assembly will hopefully always be natural part of .NET Framework... But I wonder why do you still use that much code lines in your function? Isn't that good enough? private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } Am I missing something? Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From shamil at users.mns.ru Tue Mar 25 14:11:13 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 22:11:13 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: <00a501c88ea4$ed161fd0$0201a8c0@M90> Message-ID: <000f01c88eab$fe701810$6401a8c0@nant> <<< And of course all aggravated by "sql server gurus" who execute code through the command prompt. >>> John, I'm not one of them, do you believe me? :) I do use more often than anything else MS Access QBE with MS SQL attached tables to do my SQL "coding" :) - and I'm programming not "toy apps" but real life multi-layered (ASP.NET) applications with object models with hundreds and even several thousands of custom classes, many classlib DLLs etc. <<< In the end I am writing a .Net application that stores everything in metadata tables but that takes time to design and debug. >>> OK, but what for then you need an "intellisense enabled" MS SQL query editor? I mean you do not need to write that much of T-SQL queries manually if you have most of your definitions in metadata tables, do you?... <<< The rest of my time is executing queries, one by one, waiting for the results to be ready to run the next. >>> Watch PLINQ to be released soon! I might help you to naturally (and effortlessly?) execute your "data massage and export" in parallel on multi-core systems: http://spellcoder.com/blogs/bashmohandes/archive/2007/10/14/8530.aspx http://www.microsoft.com/downloads/details.aspx?FamilyID=e848dc1d-5be3-4941- 8705-024bc7f180ba&displaylang=en -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 9:21 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# And of course all aggravated by "sql server gurus" who execute code through the command prompt. I need (and am building) a "quick and dirty" script to execute about 20-30 various queries, exports to csv, imports from csvs etc to take an order for data and turn it into a csv for shipment. I need that because it takes a half a day of executing crap by hand to fill an order that should take 5 minutes of my time to specify. I have exactly two things I need to do to specify an order, enter a "number of records to export" and modify an existing view in a template database to pull the right set of data. Sometimes I have to do a few more things, but even then it is about 1/2 hour of real work. The rest of my time is executing queries, one by one, waiting for the results to be ready to run the next. In the end I am writing a .Net application that stores everything in metadata tables but that takes time to design and debug. However the time will be well worthwhile if I can fill an order in 5 minutes that takes me a half day to do by hand. John W. Colby Colby Consulting www.ColbyConsulting.com From shamil at users.mns.ru Tue Mar 25 14:22:46 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 22:22:46 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <001301c88ead$9b929360$6401a8c0@nant> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav >>> shamil at users.mns.ru 25-03-2008 19:39 >>> <<< Visual Studio shines. >>> Yes, and Microsoft.VisualBasic assembly will hopefully always be natural part of .NET Framework... But I wonder why do you still use that much code lines in your function? Isn't that good enough? private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } Am I missing something? Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Tue Mar 25 15:34:48 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 13:34:48 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000d01c88ea6$50c87950$6401a8c0@nant> References: <000d01c88ea6$50c87950$6401a8c0@nant> Message-ID: LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil From shamil at users.mns.ru Tue Mar 25 16:05:31 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Wed, 26 Mar 2008 00:05:31 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000001c88ebb$f5e911a0$6401a8c0@nant> Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Tue Mar 25 17:28:30 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 15:28:30 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000001c88ebb$f5e911a0$6401a8c0@nant> References: <000001c88ebb$f5e911a0$6401a8c0@nant> Message-ID: Shamil, In my book, you can do no wrong (unlike a certain Colby who taunts me regularly ;->). Glad you can join us once again. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 2:06 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 17:34:52 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 23:34:52 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil You are right. It was due to old habits that I used the nested if .. and because during my testing it was easier to edit. As for the local variables they often make code much easier to browse (not in this simple example) and - if you need to assign the variable something else - it will be done at one place only. As for the curly brackets or not in a simple if statement I've read several places that it is considered good coding practice to _always_ include these - even for one-line code like here: if (something) e.Handled = true Preferred: if (something) { e.Handled = true } For example, the add-in, CodeIt.Right, corrects this: http://submain.com/default.aspx?nav=products.guidelines /gustav >>> shamil at users.mns.ru 25-03-2008 20:22 >>> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav From jwcolby at colbyconsulting.com Tue Mar 25 17:37:02 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 18:37:02 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: <000001c88ebb$f5e911a0$6401a8c0@nant> Message-ID: <00bb01c88ec8$bf7d4340$0201a8c0@M90> Hey, I couldn't get you to write a book, now Shamil's in your book, but I am not? 8-( John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 6:29 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, In my book, you can do no wrong (unlike a certain Colby who taunts me regularly ;->). Glad you can join us once again. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 2:06 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Tue Mar 25 19:01:03 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 17:01:03 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <00bb01c88ec8$bf7d4340$0201a8c0@M90> References: <000001c88ebb$f5e911a0$6401a8c0@nant> <00bb01c88ec8$bf7d4340$0201a8c0@M90> Message-ID: But you didn't want a tell-all, now did you? LOL Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 3:37 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hey, I couldn't get you to write a book, now Shamil's in your book, but I am not? 8-( John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 6:29 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, In my book, you can do no wrong (unlike a certain Colby who taunts me regularly ;->). Glad you can join us once again. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 2:06 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Wed Mar 26 09:05:29 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Wed, 26 Mar 2008 17:05:29 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <006c01c88f4a$72bdeaa0$6401a8c0@nant> Hi Gustav, I'm not arguing :) - below are the best practices from my experience: Defining and assigning local variable could be less efficient on runtime than not using them - as I noted this is compiler's job to optimize generated code, which is executed on runtime, and C# (ILDASM) optimizer is very well done as far as I know... ..usage of local variables "stinks" according to the code refactoring rules because if you imagine you have a large code (function) where a local variable/local variables is/are defined and you need to refactor this function's code by splitting it into several parts then you will have to duplicate, triplicate... your variables definitions etc... IOW refactoring by copy and paste parts of code is clearly much easier (and safer) procedure than refactoring code when you have several variables - and taking into account the note above on code optimization refactored code with several duplicated variables is becoming less and less efficient with every refactoring cycle... <<< it is considered good coding practice to _always_ include these >>> Well, I'd note that when you can write one line if (something) e.Handled = true then better write this one line - reason IMO is that the display space is limited and it's better to have your code lines as compact as possible (but without loosing readability of course) - you can watch this trend in VS2008 where properties (get/set) can be defined in one line (http://refact.blogspot.com/2008/01/c-in-vs-2008.html ) That code: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } Would be a four lines code or even two lines code if I write it in my projects: - 1st line - function signature; - 2nd line - { } That's a useful feature of C# you can format your code manually as it better suits you - and forget the automated code beautifiers - these are not for real men :) Of course there are no absolute rules, and coding style is often very dependent on one's own taste, IOW once again I'm not arguing, I'm just explaining why I'd recommend the coding style I usually follow, the coding style, which is based on many different recommendations and experiences including my own... Thank you :) -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, March 26, 2008 1:35 AM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil You are right. It was due to old habits that I used the nested if .. and because during my testing it was easier to edit. As for the local variables they often make code much easier to browse (not in this simple example) and - if you need to assign the variable something else - it will be done at one place only. As for the curly brackets or not in a simple if statement I've read several places that it is considered good coding practice to _always_ include these - even for one-line code like here: if (something) e.Handled = true Preferred: if (something) { e.Handled = true } For example, the add-in, CodeIt.Right, corrects this: http://submain.com/default.aspx?nav=products.guidelines /gustav >>> shamil at users.mns.ru 25-03-2008 20:22 >>> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Wed Mar 26 11:39:56 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Wed, 26 Mar 2008 17:39:56 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil I'm listening carefully ... I see your point about the local variables. Seems I should reconsider ... I noticed that if in VS you change the name of anything, the editor tries to locate all occurrences of this and suggest to rename ... and that kills one of the arguments for using local variables. And if the compiler anyway creates its own variables on the fly why should I bother? I didn't know that. As for the use of the optional curled brackets I'm not so sure. For example if you choose to use refactoring to encapsulate a local variable in a class, the refactoring engine tosses curled brackets all over, but I found it easier just to let them stay rather than going through a lot of manual editing. But let's see - habits change. One more is to prefix private variables with an underscore. That is so weird to me, but I can see the idea so I try ... /gustav >>> shamil at users.mns.ru 26-03-2008 15:05:29 >>> Hi Gustav, I'm not arguing :) - below are the best practices from my experience: Defining and assigning local variable could be less efficient on runtime than not using them - as I noted this is compiler's job to optimize generated code, which is executed on runtime, and C# (ILDASM) optimizer is very well done as far as I know... ..usage of local variables "stinks" according to the code refactoring rules because if you imagine you have a large code (function) where a local variable/local variables is/are defined and you need to refactor this function's code by splitting it into several parts then you will have to duplicate, triplicate... your variables definitions etc... IOW refactoring by copy and paste parts of code is clearly much easier (and safer) procedure than refactoring code when you have several variables - and taking into account the note above on code optimization refactored code with several duplicated variables is becoming less and less efficient with every refactoring cycle... <<< it is considered good coding practice to _always_ include these >>> Well, I'd note that when you can write one line if (something) e.Handled = true then better write this one line - reason IMO is that the display space is limited and it's better to have your code lines as compact as possible (but without loosing readability of course) - you can watch this trend in VS2008 where properties (get/set) can be defined in one line (http://refact.blogspot.com/2008/01/c-in-vs-2008.html ) That code: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } Would be a four lines code or even two lines code if I write it in my projects: - 1st line - function signature; - 2nd line - { } That's a useful feature of C# you can format your code manually as it better suits you - and forget the automated code beautifiers - these are not for real men :) Of course there are no absolute rules, and coding style is often very dependent on one's own taste, IOW once again I'm not arguing, I'm just explaining why I'd recommend the coding style I usually follow, the coding style, which is based on many different recommendations and experiences including my own... Thank you :) -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, March 26, 2008 1:35 AM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil You are right. It was due to old habits that I used the nested if .. and because during my testing it was easier to edit. As for the local variables they often make code much easier to browse (not in this simple example) and - if you need to assign the variable something else - it will be done at one place only. As for the curly brackets or not in a simple if statement I've read several places that it is considered good coding practice to _always_ include these - even for one-line code like here: if (something) e.Handled = true Preferred: if (something) { e.Handled = true } For example, the add-in, CodeIt.Right, corrects this: http://submain.com/default.aspx?nav=products.guidelines /gustav >>> shamil at users.mns.ru 25-03-2008 20:22 >>> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav From shamil at users.mns.ru Wed Mar 26 12:39:35 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Wed, 26 Mar 2008 20:39:35 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000901c88f68$5b6efbf0$6401a8c0@nant> Hi Gustav, <<< But let's see - habits change. >>> Yes, they do change... :) <<< One more is to prefix private variables with an underscore. That is so weird to me, but I can see the idea so I try ... >>> ... and this is what also for me a "habit change" shift after 10+ years programming using Hungarian Notation and LRNC but this now I do use this underscore prefixing subconsciously, and it's useful habit: - private variables are underscored prefixed; - parameters are started with lower case char; - public variables (fields)/properties/methods are named using CamelCasing And one can instantly see from the code what scope/origin this or that variable/parameter/property/method has... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, March 26, 2008 7:40 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil I'm listening carefully ... I see your point about the local variables. Seems I should reconsider ... I noticed that if in VS you change the name of anything, the editor tries to locate all occurrences of this and suggest to rename ... and that kills one of the arguments for using local variables. And if the compiler anyway creates its own variables on the fly why should I bother? I didn't know that. As for the use of the optional curled brackets I'm not so sure. For example if you choose to use refactoring to encapsulate a local variable in a class, the refactoring engine tosses curled brackets all over, but I found it easier just to let them stay rather than going through a lot of manual editing. But let's see - habits change. One more is to prefix private variables with an underscore. That is so weird to me, but I can see the idea so I try ... /gustav <<< tail skipped >>> From Gustav at cactus.dk Sat Mar 29 04:59:13 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Sat, 29 Mar 2008 10:59:13 +0100 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav From Gustav at cactus.dk Mon Mar 31 07:28:20 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Mon, 31 Mar 2008 14:28:20 +0200 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav From mmattys at rochester.rr.com Mon Mar 31 08:21:25 2008 From: mmattys at rochester.rr.com (Michael R Mattys) Date: Mon, 31 Mar 2008 09:21:25 -0400 Subject: [dba-VB] Article: LINQ and stored procedures References: Message-ID: <001b01c89332$202c9660$0402a8c0@Laptop> Very, very nice. Thanks, Gustav. (Seems like what JC was asking for over on SQLS) Michael R. Mattys MapPoint & Access Dev www.mattysconsulting.com ----- Original Message ----- From: "Gustav Brock" To: Sent: Monday, March 31, 2008 8:28 AM Subject: Re: [dba-VB] Article: LINQ and stored procedures > Hi all > > And here is what looks like a clever (and free) tool for SQL freaks to get > a jumpstart with LINQ in Visual Studio: > > http://www.linqpad.net/ > > /gustav > >>>> Gustav at cactus.dk 29-03-2008 10:59 >>> > Hi all > > It looks like MS is thinking of Visual Studio as a major tool for > controlling SQL Server. > An interesting article by William Sheldon in SQL Server Magazine tells > more, indeed about the SQLMetal tool: > > > Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries > convert Visual Basic and C# code into T-SQL*based database calls, which > are executed against SQL Server. Your Microsoft Visual Studio 2008 > projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. > SQLMetal generates the necessary data entity and DataContext object as > either a .vb or .cs source file. > > > http://sqlmag-pwf.texterity.com/sqlmag/200804/ > > Pick article: > LINQ to Your SQL Server Data > > A registration is needed but that is free. > > /gustav > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Mon Mar 31 09:01:26 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 31 Mar 2008 10:01:26 -0400 Subject: [dba-VB] XML Message-ID: <003401c89337$b63cc760$0201a8c0@M90> I am using the VB.Net built-in XML serializer to serialize a class to XML. I gather a bunch of data into class properties and then when the class is filled out I write it to a file. Each class represents the process of importing a single file of text data, in this case CSV data. Thus I have one XML log file per CSV file imported into a temp table. The data looks like: - PartnerShipTax20070824 FAIL 0 E:\PSM\Data\FirstAmerican\TaxRolls\PartnerShipTax20070824.txt 2008-03-31T01:11:59.225625-04:00 2008-03-31T01:14:08.8975-04:00 0 0 228716234 : 3/31/2008 1:11:59 AM : Move to Archive: E:\PSM\Data\FirstAmerican\TaxRolls\Archive\PartnerShipTax20070817.txt 228716250 : 3/31/2008 1:11:59 AM : Loading CSVReader3/31/2008 1:11:59 AM 228716250 : 3/31/2008 1:11:59 AM : Read File: E:\PSM\Data\FirstAmerican\TaxRolls\PartnerShipTax20070824.txt 228716265 : 3/31/2008 1:11:59 AM : File Loaded: E:\PSM\Data\FirstAmerican\TaxRolls\PartnerShipTax20070824.txt 228716265 : 3/31/2008 1:11:59 AM : Bulk Copy: tblTaxRollsUpdate 228845875 : 3/31/2008 1:14:08 AM : Bulk Copy FAILED: Maximum column length of 100,000 exceeded in column 7 in record 842,847. Set the SafetySwitch property to false if you're expecting column lengths greater than 100,000 characters to avoid this error. 228845890 : 3/31/2008 1:14:08 AM : Bulk Copy Finished: tblTaxRollsUpdate 228845890 : 3/31/2008 1:14:08 AM : RECORDS READ: 842847 228845906 : 3/31/2008 1:14:08 AM : RECORDS BULK COPIED: 840000 228845906 : 3/31/2008 1:14:08 AM : Individual table: tblPartnerShipTax20070824 IMPORT failed. I like writing the data to XML files, one xml file per import file because it allows me to go to a know location, look for a specific file, open it and scan what happened. For example this file failed to import. Knowing the file name I can go look for a matching log file and just read it. I read a bunch of files, as many as are in a process directory. As I finish filling out the class instance information I store the classes that into a collection, so at the end of the overall process I have a collection of every file that was processed. What I am trying to figure out is whether the data from each class can be stored in a common XML file? The serializer appears to build an entire file just for that class, with all the header info etc. It seems that once you get that stuff, you really just want the through written for each class. Also, is it possible to coerce the serializer to write the data type of the property into the XML file? It seems like this should be possible but I can't see how. John W. Colby Colby Consulting www.ColbyConsulting.com From shamil at users.mns.ru Mon Mar 31 09:14:16 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Mon, 31 Mar 2008 18:14:16 +0400 Subject: [dba-VB] Article: LINQ and stored procedures In-Reply-To: Message-ID: <000001c89339$80d26470$6401a8c0@nant> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 4:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Mon Mar 31 11:27:41 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Mon, 31 Mar 2008 18:27:41 +0200 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi Shamil But Web Services was introduced with VS2005. I haven't looked at this in VS2008 - have they been improved in some way? While your first link is interesting, I think I will leave the book it refers to as I anyway would rely on whatever MS has implemented in VS to create a Web Services - for the client side as well as the server side. I wouldn't into the underlying mechanics of this anyway. The other link, however, contains a brief but good explanation of the principles. What indeed caught my eye was this: 2. Create a URL to each resource. The resources should be nouns, not verbs. For example, do not use this: http://www.parts-depot.com/parts/getPart?id=00345 Note the verb, getPart. Instead, use a noun: http://www.parts-depot.com/parts/00345 I have never thought of it this way but makes good sense if you regard the information you retrieve as objects. Currently neither we or our clients have a use for a Web Service but I will keep looking for a good example. A favourite of mine for a free public service would be lookup of postal codes but the postal companies are so old fashioned. /gustav >>> shamil at users.mns.ru 31-03-2008 16:14 >>> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 4:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav From shamil at users.mns.ru Mon Mar 31 11:56:54 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Mon, 31 Mar 2008 20:56:54 +0400 Subject: [dba-VB] Article: LINQ and stored procedures In-Reply-To: Message-ID: <000d01c89350$39062570$6401a8c0@nant> <<< But Web Services was introduced with VS2005 >>> Hello Gustav, AFAIK they (SOAP/WSDL based web services) were in ASP.NET and VS from the first version - 1.0.... The link I posted here as a "big thing" is about *RESTful* Web Services - and these RESTful ones are different in principle from SOAP/WSDL based web services. RESTFul web services development is supported starting VS2008 only... The great news about RESTFul web services is that they do not need anything than base HTTP 1.1 (?) protocol support IOW they cam be implemented, released and consumed by literally any Internet tools and technologies running on HTTP... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 8:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi Shamil But Web Services was introduced with VS2005. I haven't looked at this in VS2008 - have they been improved in some way? While your first link is interesting, I think I will leave the book it refers to as I anyway would rely on whatever MS has implemented in VS to create a Web Services - for the client side as well as the server side. I wouldn't into the underlying mechanics of this anyway. The other link, however, contains a brief but good explanation of the principles. What indeed caught my eye was this: 2. Create a URL to each resource. The resources should be nouns, not verbs. For example, do not use this: http://www.parts-depot.com/parts/getPart?id=00345 Note the verb, getPart. Instead, use a noun: http://www.parts-depot.com/parts/00345 I have never thought of it this way but makes good sense if you regard the information you retrieve as objects. Currently neither we or our clients have a use for a Web Service but I will keep looking for a good example. A favourite of mine for a free public service would be lookup of postal codes but the postal companies are so old fashioned. /gustav >>> shamil at users.mns.ru 31-03-2008 16:14 >>> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 4:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Mon Mar 31 17:02:54 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 01 Apr 2008 00:02:54 +0200 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi Shamil I guess you are right. I've only made some small tests with Amazon, and didn't pay much attention to the protocols. If it is pure HTML it of course makes a big difference. We better keep an eye on this ... /gustav >>> shamil at users.mns.ru 31-03-2008 18:56 >>> <<< But Web Services was introduced with VS2005 >>> Hello Gustav, AFAIK they (SOAP/WSDL based web services) were in ASP.NET and VS from the first version - 1.0.... The link I posted here as a "big thing" is about *RESTful* Web Services - and these RESTful ones are different in principle from SOAP/WSDL based web services. RESTFul web services development is supported starting VS2008 only... The great news about RESTFul web services is that they do not need anything than base HTTP 1.1 (?) protocol support IOW they cam be implemented, released and consumed by literally any Internet tools and technologies running on HTTP... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 8:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi Shamil But Web Services was introduced with VS2005. I haven't looked at this in VS2008 - have they been improved in some way? While your first link is interesting, I think I will leave the book it refers to as I anyway would rely on whatever MS has implemented in VS to create a Web Services - for the client side as well as the server side. I wouldn't into the underlying mechanics of this anyway. The other link, however, contains a brief but good explanation of the principles. What indeed caught my eye was this: 2. Create a URL to each resource. The resources should be nouns, not verbs. For example, do not use this: http://www.parts-depot.com/parts/getPart?id=00345 Note the verb, getPart. Instead, use a noun: http://www.parts-depot.com/parts/00345 I have never thought of it this way but makes good sense if you regard the information you retrieve as objects. Currently neither we or our clients have a use for a Web Service but I will keep looking for a good example. A favourite of mine for a free public service would be lookup of postal codes but the postal companies are so old fashioned. /gustav >>> shamil at users.mns.ru 31-03-2008 16:14 >>> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil From accessd at shaw.ca Sat Mar 1 18:40:23 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Sat, 01 Mar 2008 16:40:23 -0800 Subject: [dba-VB] OT ASP nightmare In-Reply-To: References: Message-ID: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. From ebarro at verizon.net Mon Mar 3 18:52:44 2008 From: ebarro at verizon.net (Eric Barro) Date: Mon, 03 Mar 2008 16:52:44 -0800 Subject: [dba-VB] OT ASP nightmare In-Reply-To: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> Message-ID: <0JX6007N0KZ9CB05@vms173003.mailsrvcs.net> Jim, Does this just affect classic ASP stuff and not .NET stuff? Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Saturday, March 01, 2008 4:40 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] OT ASP nightmare I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From accessd at shaw.ca Mon Mar 3 23:45:40 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 03 Mar 2008 21:45:40 -0800 Subject: [dba-VB] OT ASP nightmare In-Reply-To: <0JX6007N0KZ9CB05@vms173003.mailsrvcs.net> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> <0JX6007N0KZ9CB05@vms173003.mailsrvcs.net> Message-ID: Hi Eric: It appears to affect both. Dot Net apps do not seem to run correctly and classic ASP apps do not run at all. Jim -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Eric Barro Sent: Monday, March 03, 2008 4:53 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] OT ASP nightmare Jim, Does this just affect classic ASP stuff and not .NET stuff? Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Saturday, March 01, 2008 4:40 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] OT ASP nightmare I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From accessd at shaw.ca Fri Mar 7 00:50:10 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 06 Mar 2008 22:50:10 -0800 Subject: [dba-VB] [dba-Tech] Good article In-Reply-To: <00e501c876f8$33261580$4b3a8343@SusanOne> References: <00e501c876f8$33261580$4b3a8343@SusanOne> Message-ID: <09F142CA44F04AD1AB07B83674900027@creativesystemdesigns.com> Hi All: Some new entries to current events have been added to the DBA web site (http://www.databaseadvisors.com). Both Arthur Fuller, Martin Reid have new articles out and even John Colby's database is now famous by reference. If you are a student or know one, the DreamSpark program from Microsoft is worthy of pursing. Jim From michael at ddisolutions.com.au Tue Mar 11 01:58:55 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Tue, 11 Mar 2008 17:58:55 +1100 Subject: [dba-VB] OT ASP nightmare References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local> Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M From michael at ddisolutions.com.au Tue Mar 11 03:38:11 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Tue, 11 Mar 2008 19:38:11 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> <59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From accessd at shaw.ca Tue Mar 11 15:42:19 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Tue, 11 Mar 2008 13:42:19 -0700 Subject: [dba-VB] OT ASP nightmare In-Reply-To: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> Message-ID: <058D9D08178446ABB47A1958A1093798@creativesystemdesigns.com> To all those who have been wondering what the problem was and the solution to that problem is, 4 hours on the phone to Microsoft finally created a solution. There have only been 14 cases similar to this, so I feel honoured. The solution was to go into the registries to the HKEY_CLASSES_ROOT (HKCR) and set the LOCAL SYSTEM account to have FULL control and USERS group (or authenticated users) to have READ permissions. Somehow some program... an MS update most likely changed the registry permissions. ASP can still not connect to the SQL servers but another specialist will be calling soon in the on going saga. Jim -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Saturday, March 01, 2008 4:40 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] OT ASP nightmare I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From michael at ddisolutions.com.au Thu Mar 13 01:17:22 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Thu, 13 Mar 2008 17:17:22 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Thu Mar 13 02:43:40 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Thu, 13 Mar 2008 08:43:40 +0100 Subject: [dba-VB] Data Binding values from code Message-ID: Hi Michael I doubt that - though I have no idea of how. And I guess you had other things to deal with and moved on after having done some research and experimenting ... /gustav >>> michael at ddisolutions.com.au 13-03-2008 07:17 >>> And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Thu Mar 13 10:04:15 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 13 Mar 2008 08:04:15 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> Message-ID: Since you didn't post any code, just referred to dataset, bindingsource and tableadaptor, your chances of getting a definitive answer are low. There are so many ways to do things in dot net that a general question can either elicit an avalanche of different methods or no answer at all. Is the control bound to a field or unbound? Have you looked into BindingContext? Without seeing the code you're using, it's pretty difficult to do more than say "here's how *I* do it", and that doesn't help if *I* am not using the same combination of objects that you are. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Thu Mar 13 10:19:32 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 13 Mar 2008 08:19:32 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> Message-ID: By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From michael at ddisolutions.com.au Thu Mar 13 17:50:01 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Fri, 14 Mar 2008 09:50:01 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Thu Mar 13 19:34:32 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 13 Mar 2008 17:34:32 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> Message-ID: I haven't waded through your code (I write VB.Net, so it's more work to read yours), but I noticed you're setting the Text property of the control. Why that instead of the Value property? I have seen instances when it made a difference. It's perfectly possible in my experience to set the text of a control without triggering the form's or the control's validation. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 3:50 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From michael at ddisolutions.com.au Thu Mar 13 20:22:01 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Fri, 14 Mar 2008 12:22:01 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3D2@ddi-01.DDI.local> Thanks Charlotte, VB.net has a TextBox.Value property? There is no equivalent property in C#. IIRC Access has both and it did make a difference. cheers Michael M I haven't waded through your code (I write VB.Net, so it's more work to read yours), but I noticed you're setting the Text property of the control. Why that instead of the Value property? I have seen instances when it made a difference. It's perfectly possible in my experience to set the text of a control without triggering the form's or the control's validation. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 3:50 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Fri Mar 14 10:29:40 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Fri, 14 Mar 2008 08:29:40 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3D2@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3D2@ddi-01.DDI.local> Message-ID: The CONTROL has a value property. It doesn't really make sense that there would be a difference in C# if you're using Windows controls. A textbox can hold more than text and if you wanted to apply numeric formats, they would apply to the value, which would be numeric, not to the text, which would be a string. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 6:22 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Thanks Charlotte, VB.net has a TextBox.Value property? There is no equivalent property in C#. IIRC Access has both and it did make a difference. cheers Michael M I haven't waded through your code (I write VB.Net, so it's more work to read yours), but I noticed you're setting the Text property of the control. Why that instead of the Value property? I have seen instances when it made a difference. It's perfectly possible in my experience to set the text of a control without triggering the form's or the control's validation. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 3:50 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 09:55:52 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 15:55:52 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventargs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From jwcolby at colbyconsulting.com Tue Mar 25 10:03:13 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 11:03:13 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: Message-ID: <008e01c88e89$59b7a350$0201a8c0@M90> Oh I know. Waving hand wildly in the air. Use Mid(). I just couldn't resist. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Tue Mar 25 10:11:30 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 11:11:30 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: Message-ID: <008f01c88e8a$81a78690$0201a8c0@M90> I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 10:49:23 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 16:49:23 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi John Don't hide. Even Mid(something) would be nicer than '\b' ...! /gustav >>> jwcolby at colbyconsulting.com 25-03-2008 16:03 >>> Oh I know. Waving hand wildly in the air. Use Mid(). I just couldn't resist. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From jwcolby at colbyconsulting.com Tue Mar 25 11:03:00 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 12:03:00 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: Message-ID: <009701c88e91$b3701b90$0201a8c0@M90> Yea, it reminds me of the old days when you had an ascii chart taped to the wall. Back in the day I could tell you from memory the ascii code for the space, cr, lf etc. Numbers were easy, upper and lower case not so easy, and I was always looking up the special characters. Of course REAL men don't need no steenkin ASCII chart either. ;-) John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 11:49 AM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi John Don't hide. Even Mid(something) would be nicer than '\b' ...! /gustav >>> jwcolby at colbyconsulting.com 25-03-2008 16:03 >>> Oh I know. Waving hand wildly in the air. Use Mid(). I just couldn't resist. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 11:53:09 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 19:53:09 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000501c88e98$b4a64d70$6401a8c0@nant> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 12:04:40 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 20:04:40 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: <008f01c88e8a$81a78690$0201a8c0@M90> Message-ID: <000901c88e9a$50979bc0$6401a8c0@nant> Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com From cfoust at infostatsystems.com Tue Mar 25 12:14:37 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 10:14:37 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000501c88e98$b4a64d70$6401a8c0@nant> References: <000501c88e98$b4a64d70$6401a8c0@nant> Message-ID: Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypressev enta rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Tue Mar 25 12:27:15 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 13:27:15 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000901c88e9a$50979bc0$6401a8c0@nant> References: <008f01c88e8a$81a78690$0201a8c0@M90> <000901c88e9a$50979bc0$6401a8c0@nant> Message-ID: <00a301c88e9d$78573550$0201a8c0@M90> And of course the real question is, why do you have to buy such a basic tool from a third party? That kind of stuff has been available from VBA for how many years? John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:05 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 12:57:25 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 20:57:25 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: <00a301c88e9d$78573550$0201a8c0@M90> Message-ID: <000c01c88ea1$af4d80b0$6401a8c0@nant> John, I think I have the answer :) - MS makes development tools first of all for themselves, and it is well known that only real men are working there at MS :) IOW they do not need such development support tools.... They let third-party tools to mature, and the authors of these tools to make some good money, then when MS sees that such third-party tools are highly demanded by market and can bring them good profits if they will own, polish and develop/extend them further, then they (MS) buy them with all their real stuff & staff, fire the "ballast" stuff & staff, or "kill" them completely by making similar tools from scratch... This way they (MS) save some (big) bucks on R&D... http://www.insearchofstupidity.com/ That's a real(?) monopolistic capitalism in action... LOL -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 8:27 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# And of course the real question is, why do you have to buy such a basic tool from a third party? That kind of stuff has been available from VBA for how many years? John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:05 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ From Gustav at cactus.dk Tue Mar 25 13:12:12 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 19:12:12 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventargs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From jwcolby at colbyconsulting.com Tue Mar 25 13:20:37 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 14:20:37 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000c01c88ea1$af4d80b0$6401a8c0@nant> References: <00a301c88e9d$78573550$0201a8c0@M90> <000c01c88ea1$af4d80b0$6401a8c0@nant> Message-ID: <00a501c88ea4$ed161fd0$0201a8c0@M90> And of course all aggravated by "sql server gurus" who execute code through the command prompt. I need (and am building) a "quick and dirty" script to execute about 20-30 various queries, exports to csv, imports from csvs etc to take an order for data and turn it into a csv for shipment. I need that because it takes a half a day of executing crap by hand to fill an order that should take 5 minutes of my time to specify. I have exactly two things I need to do to specify an order, enter a "number of records to export" and modify an existing view in a template database to pull the right set of data. Sometimes I have to do a few more things, but even then it is about 1/2 hour of real work. The rest of my time is executing queries, one by one, waiting for the results to be ready to run the next. In the end I am writing a .Net application that stores everything in metadata tables but that takes time to design and debug. However the time will be well worthwhile if I can fill an order in 5 minutes that takes me a half day to do by hand. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:57 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# John, I think I have the answer :) - MS makes development tools first of all for themselves, and it is well known that only real men are working there at MS :) IOW they do not need such development support tools.... They let third-party tools to mature, and the authors of these tools to make some good money, then when MS sees that such third-party tools are highly demanded by market and can bring them good profits if they will own, polish and develop/extend them further, then they (MS) buy them with all their real stuff & staff, fire the "ballast" stuff & staff, or "kill" them completely by making similar tools from scratch... This way they (MS) save some (big) bucks on R&D... http://www.insearchofstupidity.com/ That's a real(?) monopolistic capitalism in action... LOL -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 8:27 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# And of course the real question is, why do you have to buy such a basic tool from a third party? That kind of stuff has been available from VBA for how many years? John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:05 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 13:30:34 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 21:30:34 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000d01c88ea6$50c87950$6401a8c0@nant> Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypressev enta rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 13:39:50 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 21:39:50 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000e01c88ea7$9c661ec0$6401a8c0@nant> <<< Visual Studio shines. >>> Yes, and Microsoft.VisualBasic assembly will hopefully always be natural part of .NET Framework... But I wonder why do you still use that much code lines in your function? Isn't that good enough? private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } Am I missing something? Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 13:59:04 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 19:59:04 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav >>> shamil at users.mns.ru 25-03-2008 19:39 >>> <<< Visual Studio shines. >>> Yes, and Microsoft.VisualBasic assembly will hopefully always be natural part of .NET Framework... But I wonder why do you still use that much code lines in your function? Isn't that good enough? private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } Am I missing something? Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From shamil at users.mns.ru Tue Mar 25 14:11:13 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 22:11:13 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: <00a501c88ea4$ed161fd0$0201a8c0@M90> Message-ID: <000f01c88eab$fe701810$6401a8c0@nant> <<< And of course all aggravated by "sql server gurus" who execute code through the command prompt. >>> John, I'm not one of them, do you believe me? :) I do use more often than anything else MS Access QBE with MS SQL attached tables to do my SQL "coding" :) - and I'm programming not "toy apps" but real life multi-layered (ASP.NET) applications with object models with hundreds and even several thousands of custom classes, many classlib DLLs etc. <<< In the end I am writing a .Net application that stores everything in metadata tables but that takes time to design and debug. >>> OK, but what for then you need an "intellisense enabled" MS SQL query editor? I mean you do not need to write that much of T-SQL queries manually if you have most of your definitions in metadata tables, do you?... <<< The rest of my time is executing queries, one by one, waiting for the results to be ready to run the next. >>> Watch PLINQ to be released soon! I might help you to naturally (and effortlessly?) execute your "data massage and export" in parallel on multi-core systems: http://spellcoder.com/blogs/bashmohandes/archive/2007/10/14/8530.aspx http://www.microsoft.com/downloads/details.aspx?FamilyID=e848dc1d-5be3-4941- 8705-024bc7f180ba&displaylang=en -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 9:21 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# And of course all aggravated by "sql server gurus" who execute code through the command prompt. I need (and am building) a "quick and dirty" script to execute about 20-30 various queries, exports to csv, imports from csvs etc to take an order for data and turn it into a csv for shipment. I need that because it takes a half a day of executing crap by hand to fill an order that should take 5 minutes of my time to specify. I have exactly two things I need to do to specify an order, enter a "number of records to export" and modify an existing view in a template database to pull the right set of data. Sometimes I have to do a few more things, but even then it is about 1/2 hour of real work. The rest of my time is executing queries, one by one, waiting for the results to be ready to run the next. In the end I am writing a .Net application that stores everything in metadata tables but that takes time to design and debug. However the time will be well worthwhile if I can fill an order in 5 minutes that takes me a half day to do by hand. John W. Colby Colby Consulting www.ColbyConsulting.com From shamil at users.mns.ru Tue Mar 25 14:22:46 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 22:22:46 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <001301c88ead$9b929360$6401a8c0@nant> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav >>> shamil at users.mns.ru 25-03-2008 19:39 >>> <<< Visual Studio shines. >>> Yes, and Microsoft.VisualBasic assembly will hopefully always be natural part of .NET Framework... But I wonder why do you still use that much code lines in your function? Isn't that good enough? private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } Am I missing something? Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Tue Mar 25 15:34:48 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 13:34:48 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000d01c88ea6$50c87950$6401a8c0@nant> References: <000d01c88ea6$50c87950$6401a8c0@nant> Message-ID: LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil From shamil at users.mns.ru Tue Mar 25 16:05:31 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Wed, 26 Mar 2008 00:05:31 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000001c88ebb$f5e911a0$6401a8c0@nant> Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Tue Mar 25 17:28:30 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 15:28:30 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000001c88ebb$f5e911a0$6401a8c0@nant> References: <000001c88ebb$f5e911a0$6401a8c0@nant> Message-ID: Shamil, In my book, you can do no wrong (unlike a certain Colby who taunts me regularly ;->). Glad you can join us once again. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 2:06 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 17:34:52 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 23:34:52 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil You are right. It was due to old habits that I used the nested if .. and because during my testing it was easier to edit. As for the local variables they often make code much easier to browse (not in this simple example) and - if you need to assign the variable something else - it will be done at one place only. As for the curly brackets or not in a simple if statement I've read several places that it is considered good coding practice to _always_ include these - even for one-line code like here: if (something) e.Handled = true Preferred: if (something) { e.Handled = true } For example, the add-in, CodeIt.Right, corrects this: http://submain.com/default.aspx?nav=products.guidelines /gustav >>> shamil at users.mns.ru 25-03-2008 20:22 >>> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav From jwcolby at colbyconsulting.com Tue Mar 25 17:37:02 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 18:37:02 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: <000001c88ebb$f5e911a0$6401a8c0@nant> Message-ID: <00bb01c88ec8$bf7d4340$0201a8c0@M90> Hey, I couldn't get you to write a book, now Shamil's in your book, but I am not? 8-( John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 6:29 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, In my book, you can do no wrong (unlike a certain Colby who taunts me regularly ;->). Glad you can join us once again. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 2:06 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Tue Mar 25 19:01:03 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 17:01:03 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <00bb01c88ec8$bf7d4340$0201a8c0@M90> References: <000001c88ebb$f5e911a0$6401a8c0@nant> <00bb01c88ec8$bf7d4340$0201a8c0@M90> Message-ID: But you didn't want a tell-all, now did you? LOL Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 3:37 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hey, I couldn't get you to write a book, now Shamil's in your book, but I am not? 8-( John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 6:29 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, In my book, you can do no wrong (unlike a certain Colby who taunts me regularly ;->). Glad you can join us once again. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 2:06 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Wed Mar 26 09:05:29 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Wed, 26 Mar 2008 17:05:29 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <006c01c88f4a$72bdeaa0$6401a8c0@nant> Hi Gustav, I'm not arguing :) - below are the best practices from my experience: Defining and assigning local variable could be less efficient on runtime than not using them - as I noted this is compiler's job to optimize generated code, which is executed on runtime, and C# (ILDASM) optimizer is very well done as far as I know... ..usage of local variables "stinks" according to the code refactoring rules because if you imagine you have a large code (function) where a local variable/local variables is/are defined and you need to refactor this function's code by splitting it into several parts then you will have to duplicate, triplicate... your variables definitions etc... IOW refactoring by copy and paste parts of code is clearly much easier (and safer) procedure than refactoring code when you have several variables - and taking into account the note above on code optimization refactored code with several duplicated variables is becoming less and less efficient with every refactoring cycle... <<< it is considered good coding practice to _always_ include these >>> Well, I'd note that when you can write one line if (something) e.Handled = true then better write this one line - reason IMO is that the display space is limited and it's better to have your code lines as compact as possible (but without loosing readability of course) - you can watch this trend in VS2008 where properties (get/set) can be defined in one line (http://refact.blogspot.com/2008/01/c-in-vs-2008.html ) That code: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } Would be a four lines code or even two lines code if I write it in my projects: - 1st line - function signature; - 2nd line - { } That's a useful feature of C# you can format your code manually as it better suits you - and forget the automated code beautifiers - these are not for real men :) Of course there are no absolute rules, and coding style is often very dependent on one's own taste, IOW once again I'm not arguing, I'm just explaining why I'd recommend the coding style I usually follow, the coding style, which is based on many different recommendations and experiences including my own... Thank you :) -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, March 26, 2008 1:35 AM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil You are right. It was due to old habits that I used the nested if .. and because during my testing it was easier to edit. As for the local variables they often make code much easier to browse (not in this simple example) and - if you need to assign the variable something else - it will be done at one place only. As for the curly brackets or not in a simple if statement I've read several places that it is considered good coding practice to _always_ include these - even for one-line code like here: if (something) e.Handled = true Preferred: if (something) { e.Handled = true } For example, the add-in, CodeIt.Right, corrects this: http://submain.com/default.aspx?nav=products.guidelines /gustav >>> shamil at users.mns.ru 25-03-2008 20:22 >>> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Wed Mar 26 11:39:56 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Wed, 26 Mar 2008 17:39:56 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil I'm listening carefully ... I see your point about the local variables. Seems I should reconsider ... I noticed that if in VS you change the name of anything, the editor tries to locate all occurrences of this and suggest to rename ... and that kills one of the arguments for using local variables. And if the compiler anyway creates its own variables on the fly why should I bother? I didn't know that. As for the use of the optional curled brackets I'm not so sure. For example if you choose to use refactoring to encapsulate a local variable in a class, the refactoring engine tosses curled brackets all over, but I found it easier just to let them stay rather than going through a lot of manual editing. But let's see - habits change. One more is to prefix private variables with an underscore. That is so weird to me, but I can see the idea so I try ... /gustav >>> shamil at users.mns.ru 26-03-2008 15:05:29 >>> Hi Gustav, I'm not arguing :) - below are the best practices from my experience: Defining and assigning local variable could be less efficient on runtime than not using them - as I noted this is compiler's job to optimize generated code, which is executed on runtime, and C# (ILDASM) optimizer is very well done as far as I know... ..usage of local variables "stinks" according to the code refactoring rules because if you imagine you have a large code (function) where a local variable/local variables is/are defined and you need to refactor this function's code by splitting it into several parts then you will have to duplicate, triplicate... your variables definitions etc... IOW refactoring by copy and paste parts of code is clearly much easier (and safer) procedure than refactoring code when you have several variables - and taking into account the note above on code optimization refactored code with several duplicated variables is becoming less and less efficient with every refactoring cycle... <<< it is considered good coding practice to _always_ include these >>> Well, I'd note that when you can write one line if (something) e.Handled = true then better write this one line - reason IMO is that the display space is limited and it's better to have your code lines as compact as possible (but without loosing readability of course) - you can watch this trend in VS2008 where properties (get/set) can be defined in one line (http://refact.blogspot.com/2008/01/c-in-vs-2008.html ) That code: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } Would be a four lines code or even two lines code if I write it in my projects: - 1st line - function signature; - 2nd line - { } That's a useful feature of C# you can format your code manually as it better suits you - and forget the automated code beautifiers - these are not for real men :) Of course there are no absolute rules, and coding style is often very dependent on one's own taste, IOW once again I'm not arguing, I'm just explaining why I'd recommend the coding style I usually follow, the coding style, which is based on many different recommendations and experiences including my own... Thank you :) -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, March 26, 2008 1:35 AM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil You are right. It was due to old habits that I used the nested if .. and because during my testing it was easier to edit. As for the local variables they often make code much easier to browse (not in this simple example) and - if you need to assign the variable something else - it will be done at one place only. As for the curly brackets or not in a simple if statement I've read several places that it is considered good coding practice to _always_ include these - even for one-line code like here: if (something) e.Handled = true Preferred: if (something) { e.Handled = true } For example, the add-in, CodeIt.Right, corrects this: http://submain.com/default.aspx?nav=products.guidelines /gustav >>> shamil at users.mns.ru 25-03-2008 20:22 >>> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav From shamil at users.mns.ru Wed Mar 26 12:39:35 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Wed, 26 Mar 2008 20:39:35 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000901c88f68$5b6efbf0$6401a8c0@nant> Hi Gustav, <<< But let's see - habits change. >>> Yes, they do change... :) <<< One more is to prefix private variables with an underscore. That is so weird to me, but I can see the idea so I try ... >>> ... and this is what also for me a "habit change" shift after 10+ years programming using Hungarian Notation and LRNC but this now I do use this underscore prefixing subconsciously, and it's useful habit: - private variables are underscored prefixed; - parameters are started with lower case char; - public variables (fields)/properties/methods are named using CamelCasing And one can instantly see from the code what scope/origin this or that variable/parameter/property/method has... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, March 26, 2008 7:40 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil I'm listening carefully ... I see your point about the local variables. Seems I should reconsider ... I noticed that if in VS you change the name of anything, the editor tries to locate all occurrences of this and suggest to rename ... and that kills one of the arguments for using local variables. And if the compiler anyway creates its own variables on the fly why should I bother? I didn't know that. As for the use of the optional curled brackets I'm not so sure. For example if you choose to use refactoring to encapsulate a local variable in a class, the refactoring engine tosses curled brackets all over, but I found it easier just to let them stay rather than going through a lot of manual editing. But let's see - habits change. One more is to prefix private variables with an underscore. That is so weird to me, but I can see the idea so I try ... /gustav <<< tail skipped >>> From Gustav at cactus.dk Sat Mar 29 04:59:13 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Sat, 29 Mar 2008 10:59:13 +0100 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav From Gustav at cactus.dk Mon Mar 31 07:28:20 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Mon, 31 Mar 2008 14:28:20 +0200 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav From mmattys at rochester.rr.com Mon Mar 31 08:21:25 2008 From: mmattys at rochester.rr.com (Michael R Mattys) Date: Mon, 31 Mar 2008 09:21:25 -0400 Subject: [dba-VB] Article: LINQ and stored procedures References: Message-ID: <001b01c89332$202c9660$0402a8c0@Laptop> Very, very nice. Thanks, Gustav. (Seems like what JC was asking for over on SQLS) Michael R. Mattys MapPoint & Access Dev www.mattysconsulting.com ----- Original Message ----- From: "Gustav Brock" To: Sent: Monday, March 31, 2008 8:28 AM Subject: Re: [dba-VB] Article: LINQ and stored procedures > Hi all > > And here is what looks like a clever (and free) tool for SQL freaks to get > a jumpstart with LINQ in Visual Studio: > > http://www.linqpad.net/ > > /gustav > >>>> Gustav at cactus.dk 29-03-2008 10:59 >>> > Hi all > > It looks like MS is thinking of Visual Studio as a major tool for > controlling SQL Server. > An interesting article by William Sheldon in SQL Server Magazine tells > more, indeed about the SQLMetal tool: > > > Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries > convert Visual Basic and C# code into T-SQL*based database calls, which > are executed against SQL Server. Your Microsoft Visual Studio 2008 > projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. > SQLMetal generates the necessary data entity and DataContext object as > either a .vb or .cs source file. > > > http://sqlmag-pwf.texterity.com/sqlmag/200804/ > > Pick article: > LINQ to Your SQL Server Data > > A registration is needed but that is free. > > /gustav > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Mon Mar 31 09:01:26 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 31 Mar 2008 10:01:26 -0400 Subject: [dba-VB] XML Message-ID: <003401c89337$b63cc760$0201a8c0@M90> I am using the VB.Net built-in XML serializer to serialize a class to XML. I gather a bunch of data into class properties and then when the class is filled out I write it to a file. Each class represents the process of importing a single file of text data, in this case CSV data. Thus I have one XML log file per CSV file imported into a temp table. The data looks like: - PartnerShipTax20070824 FAIL 0 E:\PSM\Data\FirstAmerican\TaxRolls\PartnerShipTax20070824.txt 2008-03-31T01:11:59.225625-04:00 2008-03-31T01:14:08.8975-04:00 0 0 228716234 : 3/31/2008 1:11:59 AM : Move to Archive: E:\PSM\Data\FirstAmerican\TaxRolls\Archive\PartnerShipTax20070817.txt 228716250 : 3/31/2008 1:11:59 AM : Loading CSVReader3/31/2008 1:11:59 AM 228716250 : 3/31/2008 1:11:59 AM : Read File: E:\PSM\Data\FirstAmerican\TaxRolls\PartnerShipTax20070824.txt 228716265 : 3/31/2008 1:11:59 AM : File Loaded: E:\PSM\Data\FirstAmerican\TaxRolls\PartnerShipTax20070824.txt 228716265 : 3/31/2008 1:11:59 AM : Bulk Copy: tblTaxRollsUpdate 228845875 : 3/31/2008 1:14:08 AM : Bulk Copy FAILED: Maximum column length of 100,000 exceeded in column 7 in record 842,847. Set the SafetySwitch property to false if you're expecting column lengths greater than 100,000 characters to avoid this error. 228845890 : 3/31/2008 1:14:08 AM : Bulk Copy Finished: tblTaxRollsUpdate 228845890 : 3/31/2008 1:14:08 AM : RECORDS READ: 842847 228845906 : 3/31/2008 1:14:08 AM : RECORDS BULK COPIED: 840000 228845906 : 3/31/2008 1:14:08 AM : Individual table: tblPartnerShipTax20070824 IMPORT failed. I like writing the data to XML files, one xml file per import file because it allows me to go to a know location, look for a specific file, open it and scan what happened. For example this file failed to import. Knowing the file name I can go look for a matching log file and just read it. I read a bunch of files, as many as are in a process directory. As I finish filling out the class instance information I store the classes that into a collection, so at the end of the overall process I have a collection of every file that was processed. What I am trying to figure out is whether the data from each class can be stored in a common XML file? The serializer appears to build an entire file just for that class, with all the header info etc. It seems that once you get that stuff, you really just want the through written for each class. Also, is it possible to coerce the serializer to write the data type of the property into the XML file? It seems like this should be possible but I can't see how. John W. Colby Colby Consulting www.ColbyConsulting.com From shamil at users.mns.ru Mon Mar 31 09:14:16 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Mon, 31 Mar 2008 18:14:16 +0400 Subject: [dba-VB] Article: LINQ and stored procedures In-Reply-To: Message-ID: <000001c89339$80d26470$6401a8c0@nant> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 4:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Mon Mar 31 11:27:41 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Mon, 31 Mar 2008 18:27:41 +0200 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi Shamil But Web Services was introduced with VS2005. I haven't looked at this in VS2008 - have they been improved in some way? While your first link is interesting, I think I will leave the book it refers to as I anyway would rely on whatever MS has implemented in VS to create a Web Services - for the client side as well as the server side. I wouldn't into the underlying mechanics of this anyway. The other link, however, contains a brief but good explanation of the principles. What indeed caught my eye was this: 2. Create a URL to each resource. The resources should be nouns, not verbs. For example, do not use this: http://www.parts-depot.com/parts/getPart?id=00345 Note the verb, getPart. Instead, use a noun: http://www.parts-depot.com/parts/00345 I have never thought of it this way but makes good sense if you regard the information you retrieve as objects. Currently neither we or our clients have a use for a Web Service but I will keep looking for a good example. A favourite of mine for a free public service would be lookup of postal codes but the postal companies are so old fashioned. /gustav >>> shamil at users.mns.ru 31-03-2008 16:14 >>> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 4:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav From shamil at users.mns.ru Mon Mar 31 11:56:54 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Mon, 31 Mar 2008 20:56:54 +0400 Subject: [dba-VB] Article: LINQ and stored procedures In-Reply-To: Message-ID: <000d01c89350$39062570$6401a8c0@nant> <<< But Web Services was introduced with VS2005 >>> Hello Gustav, AFAIK they (SOAP/WSDL based web services) were in ASP.NET and VS from the first version - 1.0.... The link I posted here as a "big thing" is about *RESTful* Web Services - and these RESTful ones are different in principle from SOAP/WSDL based web services. RESTFul web services development is supported starting VS2008 only... The great news about RESTFul web services is that they do not need anything than base HTTP 1.1 (?) protocol support IOW they cam be implemented, released and consumed by literally any Internet tools and technologies running on HTTP... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 8:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi Shamil But Web Services was introduced with VS2005. I haven't looked at this in VS2008 - have they been improved in some way? While your first link is interesting, I think I will leave the book it refers to as I anyway would rely on whatever MS has implemented in VS to create a Web Services - for the client side as well as the server side. I wouldn't into the underlying mechanics of this anyway. The other link, however, contains a brief but good explanation of the principles. What indeed caught my eye was this: 2. Create a URL to each resource. The resources should be nouns, not verbs. For example, do not use this: http://www.parts-depot.com/parts/getPart?id=00345 Note the verb, getPart. Instead, use a noun: http://www.parts-depot.com/parts/00345 I have never thought of it this way but makes good sense if you regard the information you retrieve as objects. Currently neither we or our clients have a use for a Web Service but I will keep looking for a good example. A favourite of mine for a free public service would be lookup of postal codes but the postal companies are so old fashioned. /gustav >>> shamil at users.mns.ru 31-03-2008 16:14 >>> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 4:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Mon Mar 31 17:02:54 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 01 Apr 2008 00:02:54 +0200 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi Shamil I guess you are right. I've only made some small tests with Amazon, and didn't pay much attention to the protocols. If it is pure HTML it of course makes a big difference. We better keep an eye on this ... /gustav >>> shamil at users.mns.ru 31-03-2008 18:56 >>> <<< But Web Services was introduced with VS2005 >>> Hello Gustav, AFAIK they (SOAP/WSDL based web services) were in ASP.NET and VS from the first version - 1.0.... The link I posted here as a "big thing" is about *RESTful* Web Services - and these RESTful ones are different in principle from SOAP/WSDL based web services. RESTFul web services development is supported starting VS2008 only... The great news about RESTFul web services is that they do not need anything than base HTTP 1.1 (?) protocol support IOW they cam be implemented, released and consumed by literally any Internet tools and technologies running on HTTP... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 8:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi Shamil But Web Services was introduced with VS2005. I haven't looked at this in VS2008 - have they been improved in some way? While your first link is interesting, I think I will leave the book it refers to as I anyway would rely on whatever MS has implemented in VS to create a Web Services - for the client side as well as the server side. I wouldn't into the underlying mechanics of this anyway. The other link, however, contains a brief but good explanation of the principles. What indeed caught my eye was this: 2. Create a URL to each resource. The resources should be nouns, not verbs. For example, do not use this: http://www.parts-depot.com/parts/getPart?id=00345 Note the verb, getPart. Instead, use a noun: http://www.parts-depot.com/parts/00345 I have never thought of it this way but makes good sense if you regard the information you retrieve as objects. Currently neither we or our clients have a use for a Web Service but I will keep looking for a good example. A favourite of mine for a free public service would be lookup of postal codes but the postal companies are so old fashioned. /gustav >>> shamil at users.mns.ru 31-03-2008 16:14 >>> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil From accessd at shaw.ca Sat Mar 1 18:40:23 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Sat, 01 Mar 2008 16:40:23 -0800 Subject: [dba-VB] OT ASP nightmare In-Reply-To: References: Message-ID: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. From ebarro at verizon.net Mon Mar 3 18:52:44 2008 From: ebarro at verizon.net (Eric Barro) Date: Mon, 03 Mar 2008 16:52:44 -0800 Subject: [dba-VB] OT ASP nightmare In-Reply-To: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> Message-ID: <0JX6007N0KZ9CB05@vms173003.mailsrvcs.net> Jim, Does this just affect classic ASP stuff and not .NET stuff? Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Saturday, March 01, 2008 4:40 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] OT ASP nightmare I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From accessd at shaw.ca Mon Mar 3 23:45:40 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 03 Mar 2008 21:45:40 -0800 Subject: [dba-VB] OT ASP nightmare In-Reply-To: <0JX6007N0KZ9CB05@vms173003.mailsrvcs.net> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> <0JX6007N0KZ9CB05@vms173003.mailsrvcs.net> Message-ID: Hi Eric: It appears to affect both. Dot Net apps do not seem to run correctly and classic ASP apps do not run at all. Jim -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Eric Barro Sent: Monday, March 03, 2008 4:53 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] OT ASP nightmare Jim, Does this just affect classic ASP stuff and not .NET stuff? Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Saturday, March 01, 2008 4:40 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] OT ASP nightmare I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From accessd at shaw.ca Fri Mar 7 00:50:10 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 06 Mar 2008 22:50:10 -0800 Subject: [dba-VB] [dba-Tech] Good article In-Reply-To: <00e501c876f8$33261580$4b3a8343@SusanOne> References: <00e501c876f8$33261580$4b3a8343@SusanOne> Message-ID: <09F142CA44F04AD1AB07B83674900027@creativesystemdesigns.com> Hi All: Some new entries to current events have been added to the DBA web site (http://www.databaseadvisors.com). Both Arthur Fuller, Martin Reid have new articles out and even John Colby's database is now famous by reference. If you are a student or know one, the DreamSpark program from Microsoft is worthy of pursing. Jim From michael at ddisolutions.com.au Tue Mar 11 01:58:55 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Tue, 11 Mar 2008 17:58:55 +1100 Subject: [dba-VB] OT ASP nightmare References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local> Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M From michael at ddisolutions.com.au Tue Mar 11 03:38:11 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Tue, 11 Mar 2008 19:38:11 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> <59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From accessd at shaw.ca Tue Mar 11 15:42:19 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Tue, 11 Mar 2008 13:42:19 -0700 Subject: [dba-VB] OT ASP nightmare In-Reply-To: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> Message-ID: <058D9D08178446ABB47A1958A1093798@creativesystemdesigns.com> To all those who have been wondering what the problem was and the solution to that problem is, 4 hours on the phone to Microsoft finally created a solution. There have only been 14 cases similar to this, so I feel honoured. The solution was to go into the registries to the HKEY_CLASSES_ROOT (HKCR) and set the LOCAL SYSTEM account to have FULL control and USERS group (or authenticated users) to have READ permissions. Somehow some program... an MS update most likely changed the registry permissions. ASP can still not connect to the SQL servers but another specialist will be calling soon in the on going saga. Jim -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Saturday, March 01, 2008 4:40 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] OT ASP nightmare I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From michael at ddisolutions.com.au Thu Mar 13 01:17:22 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Thu, 13 Mar 2008 17:17:22 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Thu Mar 13 02:43:40 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Thu, 13 Mar 2008 08:43:40 +0100 Subject: [dba-VB] Data Binding values from code Message-ID: Hi Michael I doubt that - though I have no idea of how. And I guess you had other things to deal with and moved on after having done some research and experimenting ... /gustav >>> michael at ddisolutions.com.au 13-03-2008 07:17 >>> And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Thu Mar 13 10:04:15 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 13 Mar 2008 08:04:15 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> Message-ID: Since you didn't post any code, just referred to dataset, bindingsource and tableadaptor, your chances of getting a definitive answer are low. There are so many ways to do things in dot net that a general question can either elicit an avalanche of different methods or no answer at all. Is the control bound to a field or unbound? Have you looked into BindingContext? Without seeing the code you're using, it's pretty difficult to do more than say "here's how *I* do it", and that doesn't help if *I* am not using the same combination of objects that you are. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Thu Mar 13 10:19:32 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 13 Mar 2008 08:19:32 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> Message-ID: By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From michael at ddisolutions.com.au Thu Mar 13 17:50:01 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Fri, 14 Mar 2008 09:50:01 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Thu Mar 13 19:34:32 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 13 Mar 2008 17:34:32 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> Message-ID: I haven't waded through your code (I write VB.Net, so it's more work to read yours), but I noticed you're setting the Text property of the control. Why that instead of the Value property? I have seen instances when it made a difference. It's perfectly possible in my experience to set the text of a control without triggering the form's or the control's validation. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 3:50 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From michael at ddisolutions.com.au Thu Mar 13 20:22:01 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Fri, 14 Mar 2008 12:22:01 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3D2@ddi-01.DDI.local> Thanks Charlotte, VB.net has a TextBox.Value property? There is no equivalent property in C#. IIRC Access has both and it did make a difference. cheers Michael M I haven't waded through your code (I write VB.Net, so it's more work to read yours), but I noticed you're setting the Text property of the control. Why that instead of the Value property? I have seen instances when it made a difference. It's perfectly possible in my experience to set the text of a control without triggering the form's or the control's validation. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 3:50 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Fri Mar 14 10:29:40 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Fri, 14 Mar 2008 08:29:40 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3D2@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3D2@ddi-01.DDI.local> Message-ID: The CONTROL has a value property. It doesn't really make sense that there would be a difference in C# if you're using Windows controls. A textbox can hold more than text and if you wanted to apply numeric formats, they would apply to the value, which would be numeric, not to the text, which would be a string. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 6:22 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Thanks Charlotte, VB.net has a TextBox.Value property? There is no equivalent property in C#. IIRC Access has both and it did make a difference. cheers Michael M I haven't waded through your code (I write VB.Net, so it's more work to read yours), but I noticed you're setting the Text property of the control. Why that instead of the Value property? I have seen instances when it made a difference. It's perfectly possible in my experience to set the text of a control without triggering the form's or the control's validation. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 3:50 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 09:55:52 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 15:55:52 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventargs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From jwcolby at colbyconsulting.com Tue Mar 25 10:03:13 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 11:03:13 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: Message-ID: <008e01c88e89$59b7a350$0201a8c0@M90> Oh I know. Waving hand wildly in the air. Use Mid(). I just couldn't resist. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Tue Mar 25 10:11:30 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 11:11:30 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: Message-ID: <008f01c88e8a$81a78690$0201a8c0@M90> I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 10:49:23 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 16:49:23 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi John Don't hide. Even Mid(something) would be nicer than '\b' ...! /gustav >>> jwcolby at colbyconsulting.com 25-03-2008 16:03 >>> Oh I know. Waving hand wildly in the air. Use Mid(). I just couldn't resist. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From jwcolby at colbyconsulting.com Tue Mar 25 11:03:00 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 12:03:00 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: Message-ID: <009701c88e91$b3701b90$0201a8c0@M90> Yea, it reminds me of the old days when you had an ascii chart taped to the wall. Back in the day I could tell you from memory the ascii code for the space, cr, lf etc. Numbers were easy, upper and lower case not so easy, and I was always looking up the special characters. Of course REAL men don't need no steenkin ASCII chart either. ;-) John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 11:49 AM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi John Don't hide. Even Mid(something) would be nicer than '\b' ...! /gustav >>> jwcolby at colbyconsulting.com 25-03-2008 16:03 >>> Oh I know. Waving hand wildly in the air. Use Mid(). I just couldn't resist. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 11:53:09 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 19:53:09 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000501c88e98$b4a64d70$6401a8c0@nant> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 12:04:40 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 20:04:40 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: <008f01c88e8a$81a78690$0201a8c0@M90> Message-ID: <000901c88e9a$50979bc0$6401a8c0@nant> Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com From cfoust at infostatsystems.com Tue Mar 25 12:14:37 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 10:14:37 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000501c88e98$b4a64d70$6401a8c0@nant> References: <000501c88e98$b4a64d70$6401a8c0@nant> Message-ID: Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypressev enta rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Tue Mar 25 12:27:15 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 13:27:15 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000901c88e9a$50979bc0$6401a8c0@nant> References: <008f01c88e8a$81a78690$0201a8c0@M90> <000901c88e9a$50979bc0$6401a8c0@nant> Message-ID: <00a301c88e9d$78573550$0201a8c0@M90> And of course the real question is, why do you have to buy such a basic tool from a third party? That kind of stuff has been available from VBA for how many years? John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:05 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 12:57:25 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 20:57:25 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: <00a301c88e9d$78573550$0201a8c0@M90> Message-ID: <000c01c88ea1$af4d80b0$6401a8c0@nant> John, I think I have the answer :) - MS makes development tools first of all for themselves, and it is well known that only real men are working there at MS :) IOW they do not need such development support tools.... They let third-party tools to mature, and the authors of these tools to make some good money, then when MS sees that such third-party tools are highly demanded by market and can bring them good profits if they will own, polish and develop/extend them further, then they (MS) buy them with all their real stuff & staff, fire the "ballast" stuff & staff, or "kill" them completely by making similar tools from scratch... This way they (MS) save some (big) bucks on R&D... http://www.insearchofstupidity.com/ That's a real(?) monopolistic capitalism in action... LOL -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 8:27 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# And of course the real question is, why do you have to buy such a basic tool from a third party? That kind of stuff has been available from VBA for how many years? John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:05 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ From Gustav at cactus.dk Tue Mar 25 13:12:12 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 19:12:12 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventargs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From jwcolby at colbyconsulting.com Tue Mar 25 13:20:37 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 14:20:37 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000c01c88ea1$af4d80b0$6401a8c0@nant> References: <00a301c88e9d$78573550$0201a8c0@M90> <000c01c88ea1$af4d80b0$6401a8c0@nant> Message-ID: <00a501c88ea4$ed161fd0$0201a8c0@M90> And of course all aggravated by "sql server gurus" who execute code through the command prompt. I need (and am building) a "quick and dirty" script to execute about 20-30 various queries, exports to csv, imports from csvs etc to take an order for data and turn it into a csv for shipment. I need that because it takes a half a day of executing crap by hand to fill an order that should take 5 minutes of my time to specify. I have exactly two things I need to do to specify an order, enter a "number of records to export" and modify an existing view in a template database to pull the right set of data. Sometimes I have to do a few more things, but even then it is about 1/2 hour of real work. The rest of my time is executing queries, one by one, waiting for the results to be ready to run the next. In the end I am writing a .Net application that stores everything in metadata tables but that takes time to design and debug. However the time will be well worthwhile if I can fill an order in 5 minutes that takes me a half day to do by hand. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:57 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# John, I think I have the answer :) - MS makes development tools first of all for themselves, and it is well known that only real men are working there at MS :) IOW they do not need such development support tools.... They let third-party tools to mature, and the authors of these tools to make some good money, then when MS sees that such third-party tools are highly demanded by market and can bring them good profits if they will own, polish and develop/extend them further, then they (MS) buy them with all their real stuff & staff, fire the "ballast" stuff & staff, or "kill" them completely by making similar tools from scratch... This way they (MS) save some (big) bucks on R&D... http://www.insearchofstupidity.com/ That's a real(?) monopolistic capitalism in action... LOL -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 8:27 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# And of course the real question is, why do you have to buy such a basic tool from a third party? That kind of stuff has been available from VBA for how many years? John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:05 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 13:30:34 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 21:30:34 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000d01c88ea6$50c87950$6401a8c0@nant> Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypressev enta rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 13:39:50 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 21:39:50 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000e01c88ea7$9c661ec0$6401a8c0@nant> <<< Visual Studio shines. >>> Yes, and Microsoft.VisualBasic assembly will hopefully always be natural part of .NET Framework... But I wonder why do you still use that much code lines in your function? Isn't that good enough? private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } Am I missing something? Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 13:59:04 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 19:59:04 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav >>> shamil at users.mns.ru 25-03-2008 19:39 >>> <<< Visual Studio shines. >>> Yes, and Microsoft.VisualBasic assembly will hopefully always be natural part of .NET Framework... But I wonder why do you still use that much code lines in your function? Isn't that good enough? private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } Am I missing something? Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From shamil at users.mns.ru Tue Mar 25 14:11:13 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 22:11:13 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: <00a501c88ea4$ed161fd0$0201a8c0@M90> Message-ID: <000f01c88eab$fe701810$6401a8c0@nant> <<< And of course all aggravated by "sql server gurus" who execute code through the command prompt. >>> John, I'm not one of them, do you believe me? :) I do use more often than anything else MS Access QBE with MS SQL attached tables to do my SQL "coding" :) - and I'm programming not "toy apps" but real life multi-layered (ASP.NET) applications with object models with hundreds and even several thousands of custom classes, many classlib DLLs etc. <<< In the end I am writing a .Net application that stores everything in metadata tables but that takes time to design and debug. >>> OK, but what for then you need an "intellisense enabled" MS SQL query editor? I mean you do not need to write that much of T-SQL queries manually if you have most of your definitions in metadata tables, do you?... <<< The rest of my time is executing queries, one by one, waiting for the results to be ready to run the next. >>> Watch PLINQ to be released soon! I might help you to naturally (and effortlessly?) execute your "data massage and export" in parallel on multi-core systems: http://spellcoder.com/blogs/bashmohandes/archive/2007/10/14/8530.aspx http://www.microsoft.com/downloads/details.aspx?FamilyID=e848dc1d-5be3-4941- 8705-024bc7f180ba&displaylang=en -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 9:21 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# And of course all aggravated by "sql server gurus" who execute code through the command prompt. I need (and am building) a "quick and dirty" script to execute about 20-30 various queries, exports to csv, imports from csvs etc to take an order for data and turn it into a csv for shipment. I need that because it takes a half a day of executing crap by hand to fill an order that should take 5 minutes of my time to specify. I have exactly two things I need to do to specify an order, enter a "number of records to export" and modify an existing view in a template database to pull the right set of data. Sometimes I have to do a few more things, but even then it is about 1/2 hour of real work. The rest of my time is executing queries, one by one, waiting for the results to be ready to run the next. In the end I am writing a .Net application that stores everything in metadata tables but that takes time to design and debug. However the time will be well worthwhile if I can fill an order in 5 minutes that takes me a half day to do by hand. John W. Colby Colby Consulting www.ColbyConsulting.com From shamil at users.mns.ru Tue Mar 25 14:22:46 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 22:22:46 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <001301c88ead$9b929360$6401a8c0@nant> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav >>> shamil at users.mns.ru 25-03-2008 19:39 >>> <<< Visual Studio shines. >>> Yes, and Microsoft.VisualBasic assembly will hopefully always be natural part of .NET Framework... But I wonder why do you still use that much code lines in your function? Isn't that good enough? private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } Am I missing something? Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Tue Mar 25 15:34:48 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 13:34:48 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000d01c88ea6$50c87950$6401a8c0@nant> References: <000d01c88ea6$50c87950$6401a8c0@nant> Message-ID: LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil From shamil at users.mns.ru Tue Mar 25 16:05:31 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Wed, 26 Mar 2008 00:05:31 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000001c88ebb$f5e911a0$6401a8c0@nant> Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Tue Mar 25 17:28:30 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 15:28:30 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000001c88ebb$f5e911a0$6401a8c0@nant> References: <000001c88ebb$f5e911a0$6401a8c0@nant> Message-ID: Shamil, In my book, you can do no wrong (unlike a certain Colby who taunts me regularly ;->). Glad you can join us once again. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 2:06 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 17:34:52 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 23:34:52 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil You are right. It was due to old habits that I used the nested if .. and because during my testing it was easier to edit. As for the local variables they often make code much easier to browse (not in this simple example) and - if you need to assign the variable something else - it will be done at one place only. As for the curly brackets or not in a simple if statement I've read several places that it is considered good coding practice to _always_ include these - even for one-line code like here: if (something) e.Handled = true Preferred: if (something) { e.Handled = true } For example, the add-in, CodeIt.Right, corrects this: http://submain.com/default.aspx?nav=products.guidelines /gustav >>> shamil at users.mns.ru 25-03-2008 20:22 >>> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav From jwcolby at colbyconsulting.com Tue Mar 25 17:37:02 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 18:37:02 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: <000001c88ebb$f5e911a0$6401a8c0@nant> Message-ID: <00bb01c88ec8$bf7d4340$0201a8c0@M90> Hey, I couldn't get you to write a book, now Shamil's in your book, but I am not? 8-( John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 6:29 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, In my book, you can do no wrong (unlike a certain Colby who taunts me regularly ;->). Glad you can join us once again. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 2:06 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Tue Mar 25 19:01:03 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 17:01:03 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <00bb01c88ec8$bf7d4340$0201a8c0@M90> References: <000001c88ebb$f5e911a0$6401a8c0@nant> <00bb01c88ec8$bf7d4340$0201a8c0@M90> Message-ID: But you didn't want a tell-all, now did you? LOL Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 3:37 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hey, I couldn't get you to write a book, now Shamil's in your book, but I am not? 8-( John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 6:29 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, In my book, you can do no wrong (unlike a certain Colby who taunts me regularly ;->). Glad you can join us once again. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 2:06 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Wed Mar 26 09:05:29 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Wed, 26 Mar 2008 17:05:29 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <006c01c88f4a$72bdeaa0$6401a8c0@nant> Hi Gustav, I'm not arguing :) - below are the best practices from my experience: Defining and assigning local variable could be less efficient on runtime than not using them - as I noted this is compiler's job to optimize generated code, which is executed on runtime, and C# (ILDASM) optimizer is very well done as far as I know... ..usage of local variables "stinks" according to the code refactoring rules because if you imagine you have a large code (function) where a local variable/local variables is/are defined and you need to refactor this function's code by splitting it into several parts then you will have to duplicate, triplicate... your variables definitions etc... IOW refactoring by copy and paste parts of code is clearly much easier (and safer) procedure than refactoring code when you have several variables - and taking into account the note above on code optimization refactored code with several duplicated variables is becoming less and less efficient with every refactoring cycle... <<< it is considered good coding practice to _always_ include these >>> Well, I'd note that when you can write one line if (something) e.Handled = true then better write this one line - reason IMO is that the display space is limited and it's better to have your code lines as compact as possible (but without loosing readability of course) - you can watch this trend in VS2008 where properties (get/set) can be defined in one line (http://refact.blogspot.com/2008/01/c-in-vs-2008.html ) That code: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } Would be a four lines code or even two lines code if I write it in my projects: - 1st line - function signature; - 2nd line - { } That's a useful feature of C# you can format your code manually as it better suits you - and forget the automated code beautifiers - these are not for real men :) Of course there are no absolute rules, and coding style is often very dependent on one's own taste, IOW once again I'm not arguing, I'm just explaining why I'd recommend the coding style I usually follow, the coding style, which is based on many different recommendations and experiences including my own... Thank you :) -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, March 26, 2008 1:35 AM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil You are right. It was due to old habits that I used the nested if .. and because during my testing it was easier to edit. As for the local variables they often make code much easier to browse (not in this simple example) and - if you need to assign the variable something else - it will be done at one place only. As for the curly brackets or not in a simple if statement I've read several places that it is considered good coding practice to _always_ include these - even for one-line code like here: if (something) e.Handled = true Preferred: if (something) { e.Handled = true } For example, the add-in, CodeIt.Right, corrects this: http://submain.com/default.aspx?nav=products.guidelines /gustav >>> shamil at users.mns.ru 25-03-2008 20:22 >>> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Wed Mar 26 11:39:56 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Wed, 26 Mar 2008 17:39:56 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil I'm listening carefully ... I see your point about the local variables. Seems I should reconsider ... I noticed that if in VS you change the name of anything, the editor tries to locate all occurrences of this and suggest to rename ... and that kills one of the arguments for using local variables. And if the compiler anyway creates its own variables on the fly why should I bother? I didn't know that. As for the use of the optional curled brackets I'm not so sure. For example if you choose to use refactoring to encapsulate a local variable in a class, the refactoring engine tosses curled brackets all over, but I found it easier just to let them stay rather than going through a lot of manual editing. But let's see - habits change. One more is to prefix private variables with an underscore. That is so weird to me, but I can see the idea so I try ... /gustav >>> shamil at users.mns.ru 26-03-2008 15:05:29 >>> Hi Gustav, I'm not arguing :) - below are the best practices from my experience: Defining and assigning local variable could be less efficient on runtime than not using them - as I noted this is compiler's job to optimize generated code, which is executed on runtime, and C# (ILDASM) optimizer is very well done as far as I know... ..usage of local variables "stinks" according to the code refactoring rules because if you imagine you have a large code (function) where a local variable/local variables is/are defined and you need to refactor this function's code by splitting it into several parts then you will have to duplicate, triplicate... your variables definitions etc... IOW refactoring by copy and paste parts of code is clearly much easier (and safer) procedure than refactoring code when you have several variables - and taking into account the note above on code optimization refactored code with several duplicated variables is becoming less and less efficient with every refactoring cycle... <<< it is considered good coding practice to _always_ include these >>> Well, I'd note that when you can write one line if (something) e.Handled = true then better write this one line - reason IMO is that the display space is limited and it's better to have your code lines as compact as possible (but without loosing readability of course) - you can watch this trend in VS2008 where properties (get/set) can be defined in one line (http://refact.blogspot.com/2008/01/c-in-vs-2008.html ) That code: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } Would be a four lines code or even two lines code if I write it in my projects: - 1st line - function signature; - 2nd line - { } That's a useful feature of C# you can format your code manually as it better suits you - and forget the automated code beautifiers - these are not for real men :) Of course there are no absolute rules, and coding style is often very dependent on one's own taste, IOW once again I'm not arguing, I'm just explaining why I'd recommend the coding style I usually follow, the coding style, which is based on many different recommendations and experiences including my own... Thank you :) -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, March 26, 2008 1:35 AM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil You are right. It was due to old habits that I used the nested if .. and because during my testing it was easier to edit. As for the local variables they often make code much easier to browse (not in this simple example) and - if you need to assign the variable something else - it will be done at one place only. As for the curly brackets or not in a simple if statement I've read several places that it is considered good coding practice to _always_ include these - even for one-line code like here: if (something) e.Handled = true Preferred: if (something) { e.Handled = true } For example, the add-in, CodeIt.Right, corrects this: http://submain.com/default.aspx?nav=products.guidelines /gustav >>> shamil at users.mns.ru 25-03-2008 20:22 >>> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav From shamil at users.mns.ru Wed Mar 26 12:39:35 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Wed, 26 Mar 2008 20:39:35 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000901c88f68$5b6efbf0$6401a8c0@nant> Hi Gustav, <<< But let's see - habits change. >>> Yes, they do change... :) <<< One more is to prefix private variables with an underscore. That is so weird to me, but I can see the idea so I try ... >>> ... and this is what also for me a "habit change" shift after 10+ years programming using Hungarian Notation and LRNC but this now I do use this underscore prefixing subconsciously, and it's useful habit: - private variables are underscored prefixed; - parameters are started with lower case char; - public variables (fields)/properties/methods are named using CamelCasing And one can instantly see from the code what scope/origin this or that variable/parameter/property/method has... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, March 26, 2008 7:40 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil I'm listening carefully ... I see your point about the local variables. Seems I should reconsider ... I noticed that if in VS you change the name of anything, the editor tries to locate all occurrences of this and suggest to rename ... and that kills one of the arguments for using local variables. And if the compiler anyway creates its own variables on the fly why should I bother? I didn't know that. As for the use of the optional curled brackets I'm not so sure. For example if you choose to use refactoring to encapsulate a local variable in a class, the refactoring engine tosses curled brackets all over, but I found it easier just to let them stay rather than going through a lot of manual editing. But let's see - habits change. One more is to prefix private variables with an underscore. That is so weird to me, but I can see the idea so I try ... /gustav <<< tail skipped >>> From Gustav at cactus.dk Sat Mar 29 04:59:13 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Sat, 29 Mar 2008 10:59:13 +0100 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav From Gustav at cactus.dk Mon Mar 31 07:28:20 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Mon, 31 Mar 2008 14:28:20 +0200 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav From mmattys at rochester.rr.com Mon Mar 31 08:21:25 2008 From: mmattys at rochester.rr.com (Michael R Mattys) Date: Mon, 31 Mar 2008 09:21:25 -0400 Subject: [dba-VB] Article: LINQ and stored procedures References: Message-ID: <001b01c89332$202c9660$0402a8c0@Laptop> Very, very nice. Thanks, Gustav. (Seems like what JC was asking for over on SQLS) Michael R. Mattys MapPoint & Access Dev www.mattysconsulting.com ----- Original Message ----- From: "Gustav Brock" To: Sent: Monday, March 31, 2008 8:28 AM Subject: Re: [dba-VB] Article: LINQ and stored procedures > Hi all > > And here is what looks like a clever (and free) tool for SQL freaks to get > a jumpstart with LINQ in Visual Studio: > > http://www.linqpad.net/ > > /gustav > >>>> Gustav at cactus.dk 29-03-2008 10:59 >>> > Hi all > > It looks like MS is thinking of Visual Studio as a major tool for > controlling SQL Server. > An interesting article by William Sheldon in SQL Server Magazine tells > more, indeed about the SQLMetal tool: > > > Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries > convert Visual Basic and C# code into T-SQL*based database calls, which > are executed against SQL Server. Your Microsoft Visual Studio 2008 > projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. > SQLMetal generates the necessary data entity and DataContext object as > either a .vb or .cs source file. > > > http://sqlmag-pwf.texterity.com/sqlmag/200804/ > > Pick article: > LINQ to Your SQL Server Data > > A registration is needed but that is free. > > /gustav > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Mon Mar 31 09:01:26 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 31 Mar 2008 10:01:26 -0400 Subject: [dba-VB] XML Message-ID: <003401c89337$b63cc760$0201a8c0@M90> I am using the VB.Net built-in XML serializer to serialize a class to XML. I gather a bunch of data into class properties and then when the class is filled out I write it to a file. Each class represents the process of importing a single file of text data, in this case CSV data. Thus I have one XML log file per CSV file imported into a temp table. The data looks like: - PartnerShipTax20070824 FAIL 0 E:\PSM\Data\FirstAmerican\TaxRolls\PartnerShipTax20070824.txt 2008-03-31T01:11:59.225625-04:00 2008-03-31T01:14:08.8975-04:00 0 0 228716234 : 3/31/2008 1:11:59 AM : Move to Archive: E:\PSM\Data\FirstAmerican\TaxRolls\Archive\PartnerShipTax20070817.txt 228716250 : 3/31/2008 1:11:59 AM : Loading CSVReader3/31/2008 1:11:59 AM 228716250 : 3/31/2008 1:11:59 AM : Read File: E:\PSM\Data\FirstAmerican\TaxRolls\PartnerShipTax20070824.txt 228716265 : 3/31/2008 1:11:59 AM : File Loaded: E:\PSM\Data\FirstAmerican\TaxRolls\PartnerShipTax20070824.txt 228716265 : 3/31/2008 1:11:59 AM : Bulk Copy: tblTaxRollsUpdate 228845875 : 3/31/2008 1:14:08 AM : Bulk Copy FAILED: Maximum column length of 100,000 exceeded in column 7 in record 842,847. Set the SafetySwitch property to false if you're expecting column lengths greater than 100,000 characters to avoid this error. 228845890 : 3/31/2008 1:14:08 AM : Bulk Copy Finished: tblTaxRollsUpdate 228845890 : 3/31/2008 1:14:08 AM : RECORDS READ: 842847 228845906 : 3/31/2008 1:14:08 AM : RECORDS BULK COPIED: 840000 228845906 : 3/31/2008 1:14:08 AM : Individual table: tblPartnerShipTax20070824 IMPORT failed. I like writing the data to XML files, one xml file per import file because it allows me to go to a know location, look for a specific file, open it and scan what happened. For example this file failed to import. Knowing the file name I can go look for a matching log file and just read it. I read a bunch of files, as many as are in a process directory. As I finish filling out the class instance information I store the classes that into a collection, so at the end of the overall process I have a collection of every file that was processed. What I am trying to figure out is whether the data from each class can be stored in a common XML file? The serializer appears to build an entire file just for that class, with all the header info etc. It seems that once you get that stuff, you really just want the through written for each class. Also, is it possible to coerce the serializer to write the data type of the property into the XML file? It seems like this should be possible but I can't see how. John W. Colby Colby Consulting www.ColbyConsulting.com From shamil at users.mns.ru Mon Mar 31 09:14:16 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Mon, 31 Mar 2008 18:14:16 +0400 Subject: [dba-VB] Article: LINQ and stored procedures In-Reply-To: Message-ID: <000001c89339$80d26470$6401a8c0@nant> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 4:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Mon Mar 31 11:27:41 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Mon, 31 Mar 2008 18:27:41 +0200 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi Shamil But Web Services was introduced with VS2005. I haven't looked at this in VS2008 - have they been improved in some way? While your first link is interesting, I think I will leave the book it refers to as I anyway would rely on whatever MS has implemented in VS to create a Web Services - for the client side as well as the server side. I wouldn't into the underlying mechanics of this anyway. The other link, however, contains a brief but good explanation of the principles. What indeed caught my eye was this: 2. Create a URL to each resource. The resources should be nouns, not verbs. For example, do not use this: http://www.parts-depot.com/parts/getPart?id=00345 Note the verb, getPart. Instead, use a noun: http://www.parts-depot.com/parts/00345 I have never thought of it this way but makes good sense if you regard the information you retrieve as objects. Currently neither we or our clients have a use for a Web Service but I will keep looking for a good example. A favourite of mine for a free public service would be lookup of postal codes but the postal companies are so old fashioned. /gustav >>> shamil at users.mns.ru 31-03-2008 16:14 >>> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 4:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav From shamil at users.mns.ru Mon Mar 31 11:56:54 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Mon, 31 Mar 2008 20:56:54 +0400 Subject: [dba-VB] Article: LINQ and stored procedures In-Reply-To: Message-ID: <000d01c89350$39062570$6401a8c0@nant> <<< But Web Services was introduced with VS2005 >>> Hello Gustav, AFAIK they (SOAP/WSDL based web services) were in ASP.NET and VS from the first version - 1.0.... The link I posted here as a "big thing" is about *RESTful* Web Services - and these RESTful ones are different in principle from SOAP/WSDL based web services. RESTFul web services development is supported starting VS2008 only... The great news about RESTFul web services is that they do not need anything than base HTTP 1.1 (?) protocol support IOW they cam be implemented, released and consumed by literally any Internet tools and technologies running on HTTP... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 8:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi Shamil But Web Services was introduced with VS2005. I haven't looked at this in VS2008 - have they been improved in some way? While your first link is interesting, I think I will leave the book it refers to as I anyway would rely on whatever MS has implemented in VS to create a Web Services - for the client side as well as the server side. I wouldn't into the underlying mechanics of this anyway. The other link, however, contains a brief but good explanation of the principles. What indeed caught my eye was this: 2. Create a URL to each resource. The resources should be nouns, not verbs. For example, do not use this: http://www.parts-depot.com/parts/getPart?id=00345 Note the verb, getPart. Instead, use a noun: http://www.parts-depot.com/parts/00345 I have never thought of it this way but makes good sense if you regard the information you retrieve as objects. Currently neither we or our clients have a use for a Web Service but I will keep looking for a good example. A favourite of mine for a free public service would be lookup of postal codes but the postal companies are so old fashioned. /gustav >>> shamil at users.mns.ru 31-03-2008 16:14 >>> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 4:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Mon Mar 31 17:02:54 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 01 Apr 2008 00:02:54 +0200 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi Shamil I guess you are right. I've only made some small tests with Amazon, and didn't pay much attention to the protocols. If it is pure HTML it of course makes a big difference. We better keep an eye on this ... /gustav >>> shamil at users.mns.ru 31-03-2008 18:56 >>> <<< But Web Services was introduced with VS2005 >>> Hello Gustav, AFAIK they (SOAP/WSDL based web services) were in ASP.NET and VS from the first version - 1.0.... The link I posted here as a "big thing" is about *RESTful* Web Services - and these RESTful ones are different in principle from SOAP/WSDL based web services. RESTFul web services development is supported starting VS2008 only... The great news about RESTFul web services is that they do not need anything than base HTTP 1.1 (?) protocol support IOW they cam be implemented, released and consumed by literally any Internet tools and technologies running on HTTP... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 8:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi Shamil But Web Services was introduced with VS2005. I haven't looked at this in VS2008 - have they been improved in some way? While your first link is interesting, I think I will leave the book it refers to as I anyway would rely on whatever MS has implemented in VS to create a Web Services - for the client side as well as the server side. I wouldn't into the underlying mechanics of this anyway. The other link, however, contains a brief but good explanation of the principles. What indeed caught my eye was this: 2. Create a URL to each resource. The resources should be nouns, not verbs. For example, do not use this: http://www.parts-depot.com/parts/getPart?id=00345 Note the verb, getPart. Instead, use a noun: http://www.parts-depot.com/parts/00345 I have never thought of it this way but makes good sense if you regard the information you retrieve as objects. Currently neither we or our clients have a use for a Web Service but I will keep looking for a good example. A favourite of mine for a free public service would be lookup of postal codes but the postal companies are so old fashioned. /gustav >>> shamil at users.mns.ru 31-03-2008 16:14 >>> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil From accessd at shaw.ca Sat Mar 1 18:40:23 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Sat, 01 Mar 2008 16:40:23 -0800 Subject: [dba-VB] OT ASP nightmare In-Reply-To: References: Message-ID: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. From ebarro at verizon.net Mon Mar 3 18:52:44 2008 From: ebarro at verizon.net (Eric Barro) Date: Mon, 03 Mar 2008 16:52:44 -0800 Subject: [dba-VB] OT ASP nightmare In-Reply-To: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> Message-ID: <0JX6007N0KZ9CB05@vms173003.mailsrvcs.net> Jim, Does this just affect classic ASP stuff and not .NET stuff? Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Saturday, March 01, 2008 4:40 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] OT ASP nightmare I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From accessd at shaw.ca Mon Mar 3 23:45:40 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 03 Mar 2008 21:45:40 -0800 Subject: [dba-VB] OT ASP nightmare In-Reply-To: <0JX6007N0KZ9CB05@vms173003.mailsrvcs.net> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> <0JX6007N0KZ9CB05@vms173003.mailsrvcs.net> Message-ID: Hi Eric: It appears to affect both. Dot Net apps do not seem to run correctly and classic ASP apps do not run at all. Jim -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Eric Barro Sent: Monday, March 03, 2008 4:53 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] OT ASP nightmare Jim, Does this just affect classic ASP stuff and not .NET stuff? Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Saturday, March 01, 2008 4:40 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] OT ASP nightmare I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From accessd at shaw.ca Fri Mar 7 00:50:10 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 06 Mar 2008 22:50:10 -0800 Subject: [dba-VB] [dba-Tech] Good article In-Reply-To: <00e501c876f8$33261580$4b3a8343@SusanOne> References: <00e501c876f8$33261580$4b3a8343@SusanOne> Message-ID: <09F142CA44F04AD1AB07B83674900027@creativesystemdesigns.com> Hi All: Some new entries to current events have been added to the DBA web site (http://www.databaseadvisors.com). Both Arthur Fuller, Martin Reid have new articles out and even John Colby's database is now famous by reference. If you are a student or know one, the DreamSpark program from Microsoft is worthy of pursing. Jim From michael at ddisolutions.com.au Tue Mar 11 01:58:55 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Tue, 11 Mar 2008 17:58:55 +1100 Subject: [dba-VB] OT ASP nightmare References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local> Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M From michael at ddisolutions.com.au Tue Mar 11 03:38:11 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Tue, 11 Mar 2008 19:38:11 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> <59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From accessd at shaw.ca Tue Mar 11 15:42:19 2008 From: accessd at shaw.ca (Jim Lawrence) Date: Tue, 11 Mar 2008 13:42:19 -0700 Subject: [dba-VB] OT ASP nightmare In-Reply-To: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com> Message-ID: <058D9D08178446ABB47A1958A1093798@creativesystemdesigns.com> To all those who have been wondering what the problem was and the solution to that problem is, 4 hours on the phone to Microsoft finally created a solution. There have only been 14 cases similar to this, so I feel honoured. The solution was to go into the registries to the HKEY_CLASSES_ROOT (HKCR) and set the LOCAL SYSTEM account to have FULL control and USERS group (or authenticated users) to have READ permissions. Somehow some program... an MS update most likely changed the registry permissions. ASP can still not connect to the SQL servers but another specialist will be calling soon in the on going saga. Jim -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Saturday, March 01, 2008 4:40 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] OT ASP nightmare I run a test bed IIS 6 server for a number of client systems using everything from ColdFusion to PHP and from standard HTML to ASP.Net. A number of sites run straight ASP. (The Database Advisors web site http://www.databaseadvisors.com is one example.) Early last week, seeing the Server is 2003, an upgrade fro fso.objects was recommended via Microsoft. The upload and install was performed and everything ran fine....NOT! >From then on all ASP applications would fail with the following error: Active Server Pages error 'ASP 0201' Invalid Default Script Language The default script language specified for this application is invalid. There is nothing wrong with the IIS configuration, the security... to that end, the IIS server has been removed completely and replaced, twice. ASP is also completely replaced within this process. There is obviously nothing changed with IIS or ASP but the Server 2003 has had some subtle changes made to either the directory/file permissions or to some entry in the registry. A week later...no joy. Has anyone had similar problems and found a solution. (Sorry no current system backups... so the next step is a dreaded system re-install.) MTIA Jim PS I have now heard of a number of other individuals, through the web, who have had similar situations but in all case the only solution has been a call to MS or a system install... serious stuff. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From michael at ddisolutions.com.au Thu Mar 13 01:17:22 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Thu, 13 Mar 2008 17:17:22 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Thu Mar 13 02:43:40 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Thu, 13 Mar 2008 08:43:40 +0100 Subject: [dba-VB] Data Binding values from code Message-ID: Hi Michael I doubt that - though I have no idea of how. And I guess you had other things to deal with and moved on after having done some research and experimenting ... /gustav >>> michael at ddisolutions.com.au 13-03-2008 07:17 >>> And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Thu Mar 13 10:04:15 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 13 Mar 2008 08:04:15 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> Message-ID: Since you didn't post any code, just referred to dataset, bindingsource and tableadaptor, your chances of getting a definitive answer are low. There are so many ways to do things in dot net that a general question can either elicit an avalanche of different methods or no answer at all. Is the control bound to a field or unbound? Have you looked into BindingContext? Without seeing the code you're using, it's pretty difficult to do more than say "here's how *I* do it", and that doesn't help if *I* am not using the same combination of objects that you are. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Thu Mar 13 10:19:32 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 13 Mar 2008 08:19:32 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> Message-ID: By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From michael at ddisolutions.com.au Thu Mar 13 17:50:01 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Fri, 14 Mar 2008 09:50:01 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Thu Mar 13 19:34:32 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 13 Mar 2008 17:34:32 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> Message-ID: I haven't waded through your code (I write VB.Net, so it's more work to read yours), but I noticed you're setting the Text property of the control. Why that instead of the Value property? I have seen instances when it made a difference. It's perfectly possible in my experience to set the text of a control without triggering the form's or the control's validation. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 3:50 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From michael at ddisolutions.com.au Thu Mar 13 20:22:01 2008 From: michael at ddisolutions.com.au (Michael Maddison) Date: Fri, 14 Mar 2008 12:22:01 +1100 Subject: [dba-VB] Data Binding values from code References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D013BF3D2@ddi-01.DDI.local> Thanks Charlotte, VB.net has a TextBox.Value property? There is no equivalent property in C#. IIRC Access has both and it did make a difference. cheers Michael M I haven't waded through your code (I write VB.Net, so it's more work to read yours), but I noticed you're setting the Text property of the control. Why that instead of the Value property? I have seen instances when it made a difference. It's perfectly possible in my experience to set the text of a control without triggering the form's or the control's validation. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 3:50 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Fri Mar 14 10:29:40 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Fri, 14 Mar 2008 08:29:40 -0700 Subject: [dba-VB] Data Binding values from code In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D013BF3D2@ddi-01.DDI.local> References: <424164CB8B314B16B3B45478896F59A2@creativesystemdesigns.com><59A61174B1F5B54B97FD4ADDE71E7D013BF39F@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3A1@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3C4@ddi-01.DDI.local><59A61174B1F5B54B97FD4ADDE71E7D013BF3CB@ddi-01.DDI.local> <59A61174B1F5B54B97FD4ADDE71E7D013BF3D2@ddi-01.DDI.local> Message-ID: The CONTROL has a value property. It doesn't really make sense that there would be a difference in C# if you're using Windows controls. A textbox can hold more than text and if you wanted to apply numeric formats, they would apply to the value, which would be numeric, not to the text, which would be a string. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 6:22 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Thanks Charlotte, VB.net has a TextBox.Value property? There is no equivalent property in C#. IIRC Access has both and it did make a difference. cheers Michael M I haven't waded through your code (I write VB.Net, so it's more work to read yours), but I noticed you're setting the Text property of the control. Why that instead of the Value property? I have seen instances when it made a difference. It's perfectly possible in my experience to set the text of a control without triggering the form's or the control's validation. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, March 13, 2008 3:50 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code Sorry guys, Wasn't complaining about not being answered. "doesn't Me.textbox.Value = "something" work? " No! Not for me. textBox.Text = "ABC"; Does not maketh the DS == Dirty. Or the BS or the CM. Or I could have completely lost the plot ;-) I usually use the NetTiers framework, where this sort of stuff is really straightforward. So I was surprised that values I was setting in code were not being sent to the db (Access). Google didn't help much, some mentions of adding custom attributes to the objects so that the binding would work. I wanted a drag n drop out of the box solution for this quick n dirty app. Anyhow, I tried adding a bindingNav control, it didn't help. I find it hard to believe that I didn't stuff up somewhere, but I didn't write much code, just dragged the objects onto the form and bound them really. I used the Update code straight out of MSDN. Deletes 1st, then updates, then addnews. Here is the code I ended up with... if ( cboSlaking.SelectedValue != null ) txtSlaking.Text = cboSlaking.SelectedValue.ToString( ); if ( cboDisperse.SelectedValue != null ) txtDispersability.Text = cboDisperse.SelectedValue.ToString( ); if ( cboVC.SelectedValue != null ) txtVCRating.Text = cboVC.SelectedValue.ToString( ); txtDepthQual.Text = cboDepthQual.SelectedValue.ToString( ); if ( !IsValid( ) ) return; if ( _isNew ) { DataRowView drv = ( DataRowView ) profilesBS.Current; //Binding updates work arround //Manually insert the row, cancel the edit for BS try { soilProfilesTA.Insert( _newProfileID, Convert.ToInt16( drv.Row.ItemArray.GetValue( 2 ) ), //Prof drv.Row.ItemArray.GetValue( 3 ).ToString( ), //GH Convert.ToInt32( drv.Row.ItemArray.GetValue( 4 ) ), //Hor sub drv.Row.ItemArray.GetValue( 5 ).ToString( ), //Hor Suff Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 6 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 6 ) ),//Depth S Convert.ToDouble( String.IsNullOrEmpty( drv.Row.ItemArray.GetValue( 7 ).ToString( ) ) ? 0 : drv.Row.ItemArray.GetValue( 7 ) ),//Depth fin String.IsNullOrEmpty( txtDepthQual.Text ) ? null : txtDepthQual.Text.ToString( ),//depth range Convert.ToInt32( drv.Row.ItemArray.GetValue( 9 ) ),//col L drv.Row.ItemArray.GetValue( 10 ).ToString( ),//col H Convert.ToInt32( drv.Row.ItemArray.GetValue( 11 ) ),//col s drv.Row.ItemArray.GetValue( 21 ).ToString( ),//mott % String.IsNullOrEmpty( txtMottlingComments.Text ) ? null : txtMottlingComments.Text.ToString( ), //Mott text drv.Row.ItemArray.GetValue( 13 ).ToString( ),//texture Convert.ToInt32( drv.Row.ItemArray.GetValue( 14 ) ),//ped Convert.ToInt32( drv.Row.ItemArray.GetValue( 15 ) ),//struct String.IsNullOrEmpty( txtComments.Text ) ? null : txtComments.Text.ToString( ), //other drv.Row.ItemArray.GetValue( 20 ).ToString( ),//stone Convert.ToInt32( txtSlaking.Text ), //slak Convert.ToInt32( txtDispersability.Text ),//disp Convert.ToInt32( txtVCRating.Text ) );//vc } catch ( Exception ex ) { MessageBox.Show( ex.Message ); return; //throw; } profilesBS.CancelEdit( ); } else { profilesBS.EndEdit( ); } Profiles.SoilProfilesDataTable newProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Added ); Profiles.SoilProfilesDataTable editedProfile = ( Profiles.SoilProfilesDataTable ) profiles1.SoilProfiles.GetChanges( DataRowState.Modified ); try { if ( newProfile != null ) { soilProfilesTA.Update( newProfile ); } if ( editedProfile != null ) { soilProfilesTA.Update( editedProfile ); } profiles1.AcceptChanges( ); } catch ( DBConcurrencyException ex ) { string customErrorMessage; customErrorMessage = "Concurrency violation\n"; customErrorMessage += ex.Row[0].ToString( ); MessageBox.Show( customErrorMessage ); } catch ( Exception ex ) { MessageBox.Show( ex.Message ); } finally { if ( newProfile != null ) { newProfile.Dispose( ); } if ( editedProfile != null ) { editedProfile.Dispose( ); } this.Close( ); } if ( !_isNew ) { DataRowView drv = (DataRowView) profilesBS.Current; if ( drv["SiteID"] != null ) { int _siteID = (int) drv["SiteID"]; // Convert.ToInt32( txtSiteID.Text.ToString( ) ); OnNewHorizonEdit( new NewHorizonEventArgs( _siteID ) ); } } cheers Michael M By the way, doesn't Me.textbox.Value = "something" work? If the dataset is dirty, you update it. I feel somehow that I'm missing the point of the question. Are you using a bindingnavigation control or what? Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Wednesday, March 12, 2008 11:17 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Data Binding values from code And the answer seems to be, if you use the built in stuff, you don't. You don't seem to be able to let the bindingsource know that the data has changed. I ended up doing a direct insert. cheers Michael M Hi, I've gone to databinding hell... How do I change a value IN CODE in a textbox on a form and get it to be written back to the db? Using Dataset, BindingSource and TableAdaptor. Typing in the textbox works just fine... cheers Michael M _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 09:55:52 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 15:55:52 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventargs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From jwcolby at colbyconsulting.com Tue Mar 25 10:03:13 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 11:03:13 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: Message-ID: <008e01c88e89$59b7a350$0201a8c0@M90> Oh I know. Waving hand wildly in the air. Use Mid(). I just couldn't resist. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Tue Mar 25 10:11:30 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 11:11:30 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: Message-ID: <008f01c88e8a$81a78690$0201a8c0@M90> I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 10:49:23 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 16:49:23 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi John Don't hide. Even Mid(something) would be nicer than '\b' ...! /gustav >>> jwcolby at colbyconsulting.com 25-03-2008 16:03 >>> Oh I know. Waving hand wildly in the air. Use Mid(). I just couldn't resist. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From jwcolby at colbyconsulting.com Tue Mar 25 11:03:00 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 12:03:00 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: Message-ID: <009701c88e91$b3701b90$0201a8c0@M90> Yea, it reminds me of the old days when you had an ascii chart taped to the wall. Back in the day I could tell you from memory the ascii code for the space, cr, lf etc. Numbers were easy, upper and lower case not so easy, and I was always looking up the special characters. Of course REAL men don't need no steenkin ASCII chart either. ;-) John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 11:49 AM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi John Don't hide. Even Mid(something) would be nicer than '\b' ...! /gustav >>> jwcolby at colbyconsulting.com 25-03-2008 16:03 >>> Oh I know. Waving hand wildly in the air. Use Mid(). I just couldn't resist. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 10:56 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 11:53:09 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 19:53:09 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000501c88e98$b4a64d70$6401a8c0@nant> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 12:04:40 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 20:04:40 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: <008f01c88e8a$81a78690$0201a8c0@M90> Message-ID: <000901c88e9a$50979bc0$6401a8c0@nant> Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com From cfoust at infostatsystems.com Tue Mar 25 12:14:37 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 10:14:37 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000501c88e98$b4a64d70$6401a8c0@nant> References: <000501c88e98$b4a64d70$6401a8c0@nant> Message-ID: Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypressev enta rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Tue Mar 25 12:27:15 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 13:27:15 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000901c88e9a$50979bc0$6401a8c0@nant> References: <008f01c88e8a$81a78690$0201a8c0@M90> <000901c88e9a$50979bc0$6401a8c0@nant> Message-ID: <00a301c88e9d$78573550$0201a8c0@M90> And of course the real question is, why do you have to buy such a basic tool from a third party? That kind of stuff has been available from VBA for how many years? John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:05 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 12:57:25 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 20:57:25 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: <00a301c88e9d$78573550$0201a8c0@M90> Message-ID: <000c01c88ea1$af4d80b0$6401a8c0@nant> John, I think I have the answer :) - MS makes development tools first of all for themselves, and it is well known that only real men are working there at MS :) IOW they do not need such development support tools.... They let third-party tools to mature, and the authors of these tools to make some good money, then when MS sees that such third-party tools are highly demanded by market and can bring them good profits if they will own, polish and develop/extend them further, then they (MS) buy them with all their real stuff & staff, fire the "ballast" stuff & staff, or "kill" them completely by making similar tools from scratch... This way they (MS) save some (big) bucks on R&D... http://www.insearchofstupidity.com/ That's a real(?) monopolistic capitalism in action... LOL -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 8:27 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# And of course the real question is, why do you have to buy such a basic tool from a third party? That kind of stuff has been available from VBA for how many years? John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:05 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ From Gustav at cactus.dk Tue Mar 25 13:12:12 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 19:12:12 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventargs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From jwcolby at colbyconsulting.com Tue Mar 25 13:20:37 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 14:20:37 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000c01c88ea1$af4d80b0$6401a8c0@nant> References: <00a301c88e9d$78573550$0201a8c0@M90> <000c01c88ea1$af4d80b0$6401a8c0@nant> Message-ID: <00a501c88ea4$ed161fd0$0201a8c0@M90> And of course all aggravated by "sql server gurus" who execute code through the command prompt. I need (and am building) a "quick and dirty" script to execute about 20-30 various queries, exports to csv, imports from csvs etc to take an order for data and turn it into a csv for shipment. I need that because it takes a half a day of executing crap by hand to fill an order that should take 5 minutes of my time to specify. I have exactly two things I need to do to specify an order, enter a "number of records to export" and modify an existing view in a template database to pull the right set of data. Sometimes I have to do a few more things, but even then it is about 1/2 hour of real work. The rest of my time is executing queries, one by one, waiting for the results to be ready to run the next. In the end I am writing a .Net application that stores everything in metadata tables but that takes time to design and debug. However the time will be well worthwhile if I can fill an order in 5 minutes that takes me a half day to do by hand. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:57 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# John, I think I have the answer :) - MS makes development tools first of all for themselves, and it is well known that only real men are working there at MS :) IOW they do not need such development support tools.... They let third-party tools to mature, and the authors of these tools to make some good money, then when MS sees that such third-party tools are highly demanded by market and can bring them good profits if they will own, polish and develop/extend them further, then they (MS) buy them with all their real stuff & staff, fire the "ballast" stuff & staff, or "kill" them completely by making similar tools from scratch... This way they (MS) save some (big) bucks on R&D... http://www.insearchofstupidity.com/ That's a real(?) monopolistic capitalism in action... LOL -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 8:27 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# And of course the real question is, why do you have to buy such a basic tool from a third party? That kind of stuff has been available from VBA for how many years? John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 1:05 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hello John, <<< "Real men don't need no stinkin' editor." >>> Yes, that's true :) "Weak" men can spend their hard earned bucks to purchase and use: http://www.red-gate.com/products/SQL_Prompt/video_main.htm -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 6:11 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# I have to tell you Gustav, I feel the same way about working in the query editor in SQL Server. Here we are in 2008, using one of the most powerful database engines in the world and the user interface reminds me of 1984. We do have color coding of keywords, but that is about as far as we get. As a language and an environment, Turbo Pascal was heads and shoulders above the working environment of SQL Server. 8-( "Real men don't need no stinkin' editor." John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 13:30:34 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 21:30:34 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000d01c88ea6$50c87950$6401a8c0@nant> Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypressev enta rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Tue Mar 25 13:39:50 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 21:39:50 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000e01c88ea7$9c661ec0$6401a8c0@nant> <<< Visual Studio shines. >>> Yes, and Microsoft.VisualBasic assembly will hopefully always be natural part of .NET Framework... But I wonder why do you still use that much code lines in your function? Isn't that good enough? private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } Am I missing something? Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 13:59:04 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 19:59:04 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav >>> shamil at users.mns.ru 25-03-2008 19:39 >>> <<< Visual Studio shines. >>> Yes, and Microsoft.VisualBasic assembly will hopefully always be natural part of .NET Framework... But I wonder why do you still use that much code lines in your function? Isn't that good enough? private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } Am I missing something? Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav From shamil at users.mns.ru Tue Mar 25 14:11:13 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 22:11:13 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: <00a501c88ea4$ed161fd0$0201a8c0@M90> Message-ID: <000f01c88eab$fe701810$6401a8c0@nant> <<< And of course all aggravated by "sql server gurus" who execute code through the command prompt. >>> John, I'm not one of them, do you believe me? :) I do use more often than anything else MS Access QBE with MS SQL attached tables to do my SQL "coding" :) - and I'm programming not "toy apps" but real life multi-layered (ASP.NET) applications with object models with hundreds and even several thousands of custom classes, many classlib DLLs etc. <<< In the end I am writing a .Net application that stores everything in metadata tables but that takes time to design and debug. >>> OK, but what for then you need an "intellisense enabled" MS SQL query editor? I mean you do not need to write that much of T-SQL queries manually if you have most of your definitions in metadata tables, do you?... <<< The rest of my time is executing queries, one by one, waiting for the results to be ready to run the next. >>> Watch PLINQ to be released soon! I might help you to naturally (and effortlessly?) execute your "data massage and export" in parallel on multi-core systems: http://spellcoder.com/blogs/bashmohandes/archive/2007/10/14/8530.aspx http://www.microsoft.com/downloads/details.aspx?FamilyID=e848dc1d-5be3-4941- 8705-024bc7f180ba&displaylang=en -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 9:21 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# And of course all aggravated by "sql server gurus" who execute code through the command prompt. I need (and am building) a "quick and dirty" script to execute about 20-30 various queries, exports to csv, imports from csvs etc to take an order for data and turn it into a csv for shipment. I need that because it takes a half a day of executing crap by hand to fill an order that should take 5 minutes of my time to specify. I have exactly two things I need to do to specify an order, enter a "number of records to export" and modify an existing view in a template database to pull the right set of data. Sometimes I have to do a few more things, but even then it is about 1/2 hour of real work. The rest of my time is executing queries, one by one, waiting for the results to be ready to run the next. In the end I am writing a .Net application that stores everything in metadata tables but that takes time to design and debug. However the time will be well worthwhile if I can fill an order in 5 minutes that takes me a half day to do by hand. John W. Colby Colby Consulting www.ColbyConsulting.com From shamil at users.mns.ru Tue Mar 25 14:22:46 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Tue, 25 Mar 2008 22:22:46 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <001301c88ead$9b929360$6401a8c0@nant> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav >>> shamil at users.mns.ru 25-03-2008 19:39 >>> <<< Visual Studio shines. >>> Yes, and Microsoft.VisualBasic assembly will hopefully always be natural part of .NET Framework... But I wonder why do you still use that much code lines in your function? Isn't that good enough? private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } Am I missing something? Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Oh, that is beautiful! I was aware that you can mix the languages but not down to this level. Now I can write code like this: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != ControlChars.Back) { e.Handled = true; } } } which even JC can read in a snap! Seriously, I'm old enough to remember ASCII 8 to be a backspace but I'm also old enough to be in doubt, and if I expect someone else to read this code it would require one line of comment like: // Check that char c is not a backspace (ASCII 8). Visual Studio shines. /gustav >>> shamil at users.mns.ru 25-03-2008 17:53 >>> Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 5:56 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] ControlChars in C# Hi all I can't believe this: http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventa rgs(VS.71).aspx In Visual Basic you have a nice class ControlChars where you, for example, ControlChars.Back for the BackSpace character. In C# you have to write ugly (char)8 or '\b' in stone age C++ style. So I have to write all this code to avoid the beep after pressing Enter in the small navigator position field of the record navigation toolbar while still be able to edit the record number with both the Delete and the BackSpace keys: private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { char c = e.KeyChar; if (Char.IsControl(c)) { if (c != (char)8) { e.Handled = true; } } } What do you do? Live with the beep or run your own homebuilt ControlChars? /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Tue Mar 25 15:34:48 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 13:34:48 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000d01c88ea6$50c87950$6401a8c0@nant> References: <000d01c88ea6$50c87950$6401a8c0@nant> Message-ID: LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil From shamil at users.mns.ru Tue Mar 25 16:05:31 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Wed, 26 Mar 2008 00:05:31 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000001c88ebb$f5e911a0$6401a8c0@nant> Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Tue Mar 25 17:28:30 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 15:28:30 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <000001c88ebb$f5e911a0$6401a8c0@nant> References: <000001c88ebb$f5e911a0$6401a8c0@nant> Message-ID: Shamil, In my book, you can do no wrong (unlike a certain Colby who taunts me regularly ;->). Glad you can join us once again. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 2:06 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Tue Mar 25 17:34:52 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 25 Mar 2008 23:34:52 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil You are right. It was due to old habits that I used the nested if .. and because during my testing it was easier to edit. As for the local variables they often make code much easier to browse (not in this simple example) and - if you need to assign the variable something else - it will be done at one place only. As for the curly brackets or not in a simple if statement I've read several places that it is considered good coding practice to _always_ include these - even for one-line code like here: if (something) e.Handled = true Preferred: if (something) { e.Handled = true } For example, the add-in, CodeIt.Right, corrects this: http://submain.com/default.aspx?nav=products.guidelines /gustav >>> shamil at users.mns.ru 25-03-2008 20:22 >>> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav From jwcolby at colbyconsulting.com Tue Mar 25 17:37:02 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 25 Mar 2008 18:37:02 -0400 Subject: [dba-VB] ControlChars in C# In-Reply-To: References: <000001c88ebb$f5e911a0$6401a8c0@nant> Message-ID: <00bb01c88ec8$bf7d4340$0201a8c0@M90> Hey, I couldn't get you to write a book, now Shamil's in your book, but I am not? 8-( John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 6:29 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, In my book, you can do no wrong (unlike a certain Colby who taunts me regularly ;->). Glad you can join us once again. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 2:06 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From cfoust at infostatsystems.com Tue Mar 25 19:01:03 2008 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Tue, 25 Mar 2008 17:01:03 -0700 Subject: [dba-VB] ControlChars in C# In-Reply-To: <00bb01c88ec8$bf7d4340$0201a8c0@M90> References: <000001c88ebb$f5e911a0$6401a8c0@nant> <00bb01c88ec8$bf7d4340$0201a8c0@M90> Message-ID: But you didn't want a tell-all, now did you? LOL Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, March 25, 2008 3:37 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hey, I couldn't get you to write a book, now Shamil's in your book, but I am not? 8-( John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 6:29 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, In my book, you can do no wrong (unlike a certain Colby who taunts me regularly ;->). Glad you can join us once again. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 2:06 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, What do you think, if I write "I think I have..." would that be accepted/treated here and personally by you as my having "the proper sense of humility"...? :) Sorry, folks, for my today's "bombardment" of this thread with my e-mails, the reason of that are that I have had a lot of work during the last months, and I almost haven't time to post here... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 11:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# LOL, well as long as you have the proper sense of humility .... ! Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 11:31 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Charlotte, I like VB(A): it literally opened the outer world for me a long ago when I have got my MS Access 2.0 application development contract from big German software house and their customers... ...I can smoothly program on both C# and Visual Basic, and sometimes still do some VB(A) programming but my heart is with C# forever :) Sorry, VB, if I wrote something looking like scoffing you, and thank you VB! -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, March 25, 2008 8:15 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] ControlChars in C# Shamil, That is a VERY sneaky trick, especially when you make gibes at VB! LOL Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Tuesday, March 25, 2008 9:53 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] ControlChars in C# Hi Gustav, In C# project you can set the reference to Microsoft.VisualBasic assembly, then write: using Microsoft.VisualBasic; .... private void bindingNavigatorPositionItem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != ControlChars.Back) e.Handled = true } BTW, unlike Visual Basic this "screwed" above code lines will be compiled well if you'll copy & paste them: I mean while posting Visual basic sample one have to be careful with line wraps etc. C# rules! Visual Basic serves :) (a kind of kidding...) Thanks. -- Shamil _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From shamil at users.mns.ru Wed Mar 26 09:05:29 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Wed, 26 Mar 2008 17:05:29 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <006c01c88f4a$72bdeaa0$6401a8c0@nant> Hi Gustav, I'm not arguing :) - below are the best practices from my experience: Defining and assigning local variable could be less efficient on runtime than not using them - as I noted this is compiler's job to optimize generated code, which is executed on runtime, and C# (ILDASM) optimizer is very well done as far as I know... ..usage of local variables "stinks" according to the code refactoring rules because if you imagine you have a large code (function) where a local variable/local variables is/are defined and you need to refactor this function's code by splitting it into several parts then you will have to duplicate, triplicate... your variables definitions etc... IOW refactoring by copy and paste parts of code is clearly much easier (and safer) procedure than refactoring code when you have several variables - and taking into account the note above on code optimization refactored code with several duplicated variables is becoming less and less efficient with every refactoring cycle... <<< it is considered good coding practice to _always_ include these >>> Well, I'd note that when you can write one line if (something) e.Handled = true then better write this one line - reason IMO is that the display space is limited and it's better to have your code lines as compact as possible (but without loosing readability of course) - you can watch this trend in VS2008 where properties (get/set) can be defined in one line (http://refact.blogspot.com/2008/01/c-in-vs-2008.html ) That code: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } Would be a four lines code or even two lines code if I write it in my projects: - 1st line - function signature; - 2nd line - { } That's a useful feature of C# you can format your code manually as it better suits you - and forget the automated code beautifiers - these are not for real men :) Of course there are no absolute rules, and coding style is often very dependent on one's own taste, IOW once again I'm not arguing, I'm just explaining why I'd recommend the coding style I usually follow, the coding style, which is based on many different recommendations and experiences including my own... Thank you :) -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, March 26, 2008 1:35 AM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil You are right. It was due to old habits that I used the nested if .. and because during my testing it was easier to edit. As for the local variables they often make code much easier to browse (not in this simple example) and - if you need to assign the variable something else - it will be done at one place only. As for the curly brackets or not in a simple if statement I've read several places that it is considered good coding practice to _always_ include these - even for one-line code like here: if (something) e.Handled = true Preferred: if (something) { e.Handled = true } For example, the add-in, CodeIt.Right, corrects this: http://submain.com/default.aspx?nav=products.guidelines /gustav >>> shamil at users.mns.ru 25-03-2008 20:22 >>> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Wed Mar 26 11:39:56 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Wed, 26 Mar 2008 17:39:56 +0100 Subject: [dba-VB] ControlChars in C# Message-ID: Hi Shamil I'm listening carefully ... I see your point about the local variables. Seems I should reconsider ... I noticed that if in VS you change the name of anything, the editor tries to locate all occurrences of this and suggest to rename ... and that kills one of the arguments for using local variables. And if the compiler anyway creates its own variables on the fly why should I bother? I didn't know that. As for the use of the optional curled brackets I'm not so sure. For example if you choose to use refactoring to encapsulate a local variable in a class, the refactoring engine tosses curled brackets all over, but I found it easier just to let them stay rather than going through a lot of manual editing. But let's see - habits change. One more is to prefix private variables with an underscore. That is so weird to me, but I can see the idea so I try ... /gustav >>> shamil at users.mns.ru 26-03-2008 15:05:29 >>> Hi Gustav, I'm not arguing :) - below are the best practices from my experience: Defining and assigning local variable could be less efficient on runtime than not using them - as I noted this is compiler's job to optimize generated code, which is executed on runtime, and C# (ILDASM) optimizer is very well done as far as I know... ..usage of local variables "stinks" according to the code refactoring rules because if you imagine you have a large code (function) where a local variable/local variables is/are defined and you need to refactor this function's code by splitting it into several parts then you will have to duplicate, triplicate... your variables definitions etc... IOW refactoring by copy and paste parts of code is clearly much easier (and safer) procedure than refactoring code when you have several variables - and taking into account the note above on code optimization refactored code with several duplicated variables is becoming less and less efficient with every refactoring cycle... <<< it is considered good coding practice to _always_ include these >>> Well, I'd note that when you can write one line if (something) e.Handled = true then better write this one line - reason IMO is that the display space is limited and it's better to have your code lines as compact as possible (but without loosing readability of course) - you can watch this trend in VS2008 where properties (get/set) can be defined in one line (http://refact.blogspot.com/2008/01/c-in-vs-2008.html ) That code: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } Would be a four lines code or even two lines code if I write it in my projects: - 1st line - function signature; - 2nd line - { } That's a useful feature of C# you can format your code manually as it better suits you - and forget the automated code beautifiers - these are not for real men :) Of course there are no absolute rules, and coding style is often very dependent on one's own taste, IOW once again I'm not arguing, I'm just explaining why I'd recommend the coding style I usually follow, the coding style, which is based on many different recommendations and experiences including my own... Thank you :) -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, March 26, 2008 1:35 AM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil You are right. It was due to old habits that I used the nested if .. and because during my testing it was easier to edit. As for the local variables they often make code much easier to browse (not in this simple example) and - if you need to assign the variable something else - it will be done at one place only. As for the curly brackets or not in a simple if statement I've read several places that it is considered good coding practice to _always_ include these - even for one-line code like here: if (something) e.Handled = true Preferred: if (something) { e.Handled = true } For example, the add-in, CodeIt.Right, corrects this: http://submain.com/default.aspx?nav=products.guidelines /gustav >>> shamil at users.mns.ru 25-03-2008 20:22 >>> Hi Gustav, Sorry, I missed the logic (it's a storm and snowfall here - my brain cells could have been influenced by that :)) I should have coded: private void bindingNavigatorPositionItem_KeyPress( object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) && e.KeyChar != ControlChars.Back) e.Handled = true } How about that? Still missing something here? Notes on coding style above, which might look unusual for VB(A) veterans (I'm one of them): 1. "Code refactoring gurus" recommend avoiding using local variables - it's a compiler's job to optimize compiled code... 2. Using 'if' with two conditional expressions "glued with &&" doesn't introduce any performance hits because if the first condition fails the second one will not be evaluated... Thanks. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, March 25, 2008 9:59 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil Yes I need all that code. If omitted, any other keypress than backspace will be "handled" meaning be inactive; thus I can only delete the digits in the record position selector (filled and updated when you navigate the table) with the backspace key, not typing any new digits. /gustav From shamil at users.mns.ru Wed Mar 26 12:39:35 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Wed, 26 Mar 2008 20:39:35 +0300 Subject: [dba-VB] ControlChars in C# In-Reply-To: Message-ID: <000901c88f68$5b6efbf0$6401a8c0@nant> Hi Gustav, <<< But let's see - habits change. >>> Yes, they do change... :) <<< One more is to prefix private variables with an underscore. That is so weird to me, but I can see the idea so I try ... >>> ... and this is what also for me a "habit change" shift after 10+ years programming using Hungarian Notation and LRNC but this now I do use this underscore prefixing subconsciously, and it's useful habit: - private variables are underscored prefixed; - parameters are started with lower case char; - public variables (fields)/properties/methods are named using CamelCasing And one can instantly see from the code what scope/origin this or that variable/parameter/property/method has... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, March 26, 2008 7:40 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] ControlChars in C# Hi Shamil I'm listening carefully ... I see your point about the local variables. Seems I should reconsider ... I noticed that if in VS you change the name of anything, the editor tries to locate all occurrences of this and suggest to rename ... and that kills one of the arguments for using local variables. And if the compiler anyway creates its own variables on the fly why should I bother? I didn't know that. As for the use of the optional curled brackets I'm not so sure. For example if you choose to use refactoring to encapsulate a local variable in a class, the refactoring engine tosses curled brackets all over, but I found it easier just to let them stay rather than going through a lot of manual editing. But let's see - habits change. One more is to prefix private variables with an underscore. That is so weird to me, but I can see the idea so I try ... /gustav <<< tail skipped >>> From Gustav at cactus.dk Sat Mar 29 04:59:13 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Sat, 29 Mar 2008 10:59:13 +0100 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav From Gustav at cactus.dk Mon Mar 31 07:28:20 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Mon, 31 Mar 2008 14:28:20 +0200 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav From mmattys at rochester.rr.com Mon Mar 31 08:21:25 2008 From: mmattys at rochester.rr.com (Michael R Mattys) Date: Mon, 31 Mar 2008 09:21:25 -0400 Subject: [dba-VB] Article: LINQ and stored procedures References: Message-ID: <001b01c89332$202c9660$0402a8c0@Laptop> Very, very nice. Thanks, Gustav. (Seems like what JC was asking for over on SQLS) Michael R. Mattys MapPoint & Access Dev www.mattysconsulting.com ----- Original Message ----- From: "Gustav Brock" To: Sent: Monday, March 31, 2008 8:28 AM Subject: Re: [dba-VB] Article: LINQ and stored procedures > Hi all > > And here is what looks like a clever (and free) tool for SQL freaks to get > a jumpstart with LINQ in Visual Studio: > > http://www.linqpad.net/ > > /gustav > >>>> Gustav at cactus.dk 29-03-2008 10:59 >>> > Hi all > > It looks like MS is thinking of Visual Studio as a major tool for > controlling SQL Server. > An interesting article by William Sheldon in SQL Server Magazine tells > more, indeed about the SQLMetal tool: > > > Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries > convert Visual Basic and C# code into T-SQL*based database calls, which > are executed against SQL Server. Your Microsoft Visual Studio 2008 > projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. > SQLMetal generates the necessary data entity and DataContext object as > either a .vb or .cs source file. > > > http://sqlmag-pwf.texterity.com/sqlmag/200804/ > > Pick article: > LINQ to Your SQL Server Data > > A registration is needed but that is free. > > /gustav > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Mon Mar 31 09:01:26 2008 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 31 Mar 2008 10:01:26 -0400 Subject: [dba-VB] XML Message-ID: <003401c89337$b63cc760$0201a8c0@M90> I am using the VB.Net built-in XML serializer to serialize a class to XML. I gather a bunch of data into class properties and then when the class is filled out I write it to a file. Each class represents the process of importing a single file of text data, in this case CSV data. Thus I have one XML log file per CSV file imported into a temp table. The data looks like: - PartnerShipTax20070824 FAIL 0 E:\PSM\Data\FirstAmerican\TaxRolls\PartnerShipTax20070824.txt 2008-03-31T01:11:59.225625-04:00 2008-03-31T01:14:08.8975-04:00 0 0 228716234 : 3/31/2008 1:11:59 AM : Move to Archive: E:\PSM\Data\FirstAmerican\TaxRolls\Archive\PartnerShipTax20070817.txt 228716250 : 3/31/2008 1:11:59 AM : Loading CSVReader3/31/2008 1:11:59 AM 228716250 : 3/31/2008 1:11:59 AM : Read File: E:\PSM\Data\FirstAmerican\TaxRolls\PartnerShipTax20070824.txt 228716265 : 3/31/2008 1:11:59 AM : File Loaded: E:\PSM\Data\FirstAmerican\TaxRolls\PartnerShipTax20070824.txt 228716265 : 3/31/2008 1:11:59 AM : Bulk Copy: tblTaxRollsUpdate 228845875 : 3/31/2008 1:14:08 AM : Bulk Copy FAILED: Maximum column length of 100,000 exceeded in column 7 in record 842,847. Set the SafetySwitch property to false if you're expecting column lengths greater than 100,000 characters to avoid this error. 228845890 : 3/31/2008 1:14:08 AM : Bulk Copy Finished: tblTaxRollsUpdate 228845890 : 3/31/2008 1:14:08 AM : RECORDS READ: 842847 228845906 : 3/31/2008 1:14:08 AM : RECORDS BULK COPIED: 840000 228845906 : 3/31/2008 1:14:08 AM : Individual table: tblPartnerShipTax20070824 IMPORT failed. I like writing the data to XML files, one xml file per import file because it allows me to go to a know location, look for a specific file, open it and scan what happened. For example this file failed to import. Knowing the file name I can go look for a matching log file and just read it. I read a bunch of files, as many as are in a process directory. As I finish filling out the class instance information I store the classes that into a collection, so at the end of the overall process I have a collection of every file that was processed. What I am trying to figure out is whether the data from each class can be stored in a common XML file? The serializer appears to build an entire file just for that class, with all the header info etc. It seems that once you get that stuff, you really just want the through written for each class. Also, is it possible to coerce the serializer to write the data type of the property into the XML file? It seems like this should be possible but I can't see how. John W. Colby Colby Consulting www.ColbyConsulting.com From shamil at users.mns.ru Mon Mar 31 09:14:16 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Mon, 31 Mar 2008 18:14:16 +0400 Subject: [dba-VB] Article: LINQ and stored procedures In-Reply-To: Message-ID: <000001c89339$80d26470$6401a8c0@nant> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 4:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Mon Mar 31 11:27:41 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Mon, 31 Mar 2008 18:27:41 +0200 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi Shamil But Web Services was introduced with VS2005. I haven't looked at this in VS2008 - have they been improved in some way? While your first link is interesting, I think I will leave the book it refers to as I anyway would rely on whatever MS has implemented in VS to create a Web Services - for the client side as well as the server side. I wouldn't into the underlying mechanics of this anyway. The other link, however, contains a brief but good explanation of the principles. What indeed caught my eye was this: 2. Create a URL to each resource. The resources should be nouns, not verbs. For example, do not use this: http://www.parts-depot.com/parts/getPart?id=00345 Note the verb, getPart. Instead, use a noun: http://www.parts-depot.com/parts/00345 I have never thought of it this way but makes good sense if you regard the information you retrieve as objects. Currently neither we or our clients have a use for a Web Service but I will keep looking for a good example. A favourite of mine for a free public service would be lookup of postal codes but the postal companies are so old fashioned. /gustav >>> shamil at users.mns.ru 31-03-2008 16:14 >>> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 4:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav From shamil at users.mns.ru Mon Mar 31 11:56:54 2008 From: shamil at users.mns.ru (Shamil Salakhetdinov) Date: Mon, 31 Mar 2008 20:56:54 +0400 Subject: [dba-VB] Article: LINQ and stored procedures In-Reply-To: Message-ID: <000d01c89350$39062570$6401a8c0@nant> <<< But Web Services was introduced with VS2005 >>> Hello Gustav, AFAIK they (SOAP/WSDL based web services) were in ASP.NET and VS from the first version - 1.0.... The link I posted here as a "big thing" is about *RESTful* Web Services - and these RESTful ones are different in principle from SOAP/WSDL based web services. RESTFul web services development is supported starting VS2008 only... The great news about RESTFul web services is that they do not need anything than base HTTP 1.1 (?) protocol support IOW they cam be implemented, released and consumed by literally any Internet tools and technologies running on HTTP... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 8:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi Shamil But Web Services was introduced with VS2005. I haven't looked at this in VS2008 - have they been improved in some way? While your first link is interesting, I think I will leave the book it refers to as I anyway would rely on whatever MS has implemented in VS to create a Web Services - for the client side as well as the server side. I wouldn't into the underlying mechanics of this anyway. The other link, however, contains a brief but good explanation of the principles. What indeed caught my eye was this: 2. Create a URL to each resource. The resources should be nouns, not verbs. For example, do not use this: http://www.parts-depot.com/parts/getPart?id=00345 Note the verb, getPart. Instead, use a noun: http://www.parts-depot.com/parts/00345 I have never thought of it this way but makes good sense if you regard the information you retrieve as objects. Currently neither we or our clients have a use for a Web Service but I will keep looking for a good example. A favourite of mine for a free public service would be lookup of postal codes but the postal companies are so old fashioned. /gustav >>> shamil at users.mns.ru 31-03-2008 16:14 >>> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 4:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi all And here is what looks like a clever (and free) tool for SQL freaks to get a jumpstart with LINQ in Visual Studio: http://www.linqpad.net/ /gustav >>> Gustav at cactus.dk 29-03-2008 10:59 >>> Hi all It looks like MS is thinking of Visual Studio as a major tool for controlling SQL Server. An interesting article by William Sheldon in SQL Server Magazine tells more, indeed about the SQLMetal tool: Microsoft Visual Studio 2008 and Language Integrated Query (LINQ) queries convert Visual Basic and C# code into T-SQL*based database calls, which are executed against SQL Server. Your Microsoft Visual Studio 2008 projects will need to target the Microsoft .NET Framework 3.5 to use LINQ. SQLMetal generates the necessary data entity and DataContext object as either a .vb or .cs source file. http://sqlmag-pwf.texterity.com/sqlmag/200804/ Pick article: LINQ to Your SQL Server Data A registration is needed but that is free. /gustav _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Gustav at cactus.dk Mon Mar 31 17:02:54 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Tue, 01 Apr 2008 00:02:54 +0200 Subject: [dba-VB] Article: LINQ and stored procedures Message-ID: Hi Shamil I guess you are right. I've only made some small tests with Amazon, and didn't pay much attention to the protocols. If it is pure HTML it of course makes a big difference. We better keep an eye on this ... /gustav >>> shamil at users.mns.ru 31-03-2008 18:56 >>> <<< But Web Services was introduced with VS2005 >>> Hello Gustav, AFAIK they (SOAP/WSDL based web services) were in ASP.NET and VS from the first version - 1.0.... The link I posted here as a "big thing" is about *RESTful* Web Services - and these RESTful ones are different in principle from SOAP/WSDL based web services. RESTFul web services development is supported starting VS2008 only... The great news about RESTFul web services is that they do not need anything than base HTTP 1.1 (?) protocol support IOW they cam be implemented, released and consumed by literally any Internet tools and technologies running on HTTP... -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, March 31, 2008 8:28 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Article: LINQ and stored procedures Hi Shamil But Web Services was introduced with VS2005. I haven't looked at this in VS2008 - have they been improved in some way? While your first link is interesting, I think I will leave the book it refers to as I anyway would rely on whatever MS has implemented in VS to create a Web Services - for the client side as well as the server side. I wouldn't into the underlying mechanics of this anyway. The other link, however, contains a brief but good explanation of the principles. What indeed caught my eye was this: 2. Create a URL to each resource. The resources should be nouns, not verbs. For example, do not use this: http://www.parts-depot.com/parts/getPart?id=00345 Note the verb, getPart. Instead, use a noun: http://www.parts-depot.com/parts/00345 I have never thought of it this way but makes good sense if you regard the information you retrieve as objects. Currently neither we or our clients have a use for a Web Service but I will keep looking for a good example. A favourite of mine for a free public service would be lookup of postal codes but the postal companies are so old fashioned. /gustav >>> shamil at users.mns.ru 31-03-2008 16:14 >>> Hi Gustav, Thank you. That info arrived just in time! :) I have started preparation to VS2008 transition today, and I do plan to start using LINQ as much as possible in the applications I'm developing... BTW, I think another big thing to consider is "RESTful Web Services" - http://www.crummy.com/writing/RESTful-Web-Services/ http://www.xfront.com/REST-Web-Services.html This concept is not from MS originally but MS released features to develop such services in VS2008... This REST and Resource Oriented Architecture (ROA) and RESTful web services could be a real breakthrough for many useful and easy to handle generic way web services to appear... -- Shamil