From paul.hartland at googlemail.com Fri Oct 6 21:38:25 2017 From: paul.hartland at googlemail.com (Paul Hartland) Date: Sat, 7 Oct 2017 03:38:25 +0100 Subject: [dba-VS] Free cloud database In-Reply-To: References: Message-ID: To all, Does anyone know of/recommend a decent free cloud database I can use even if a trial for a month or two while I try to test a few things, will be happy to pay if I decide to use it afterwards. Paul From gustav at cactus.dk Sat Oct 7 05:41:18 2017 From: gustav at cactus.dk (Gustav Brock) Date: Sat, 7 Oct 2017 10:41:18 +0000 Subject: [dba-VS] [dba-SQLServer] Free cloud database In-Reply-To: References: , Message-ID: Hi Paul The obvious place to start - Azure SQL: https://azure.microsoft.com/en-us/free/services/sql-database/ /gustav ________________________________________ Fra: dba-SQLServer p? vegne af Paul Hartland via dba-SQLServer Sendt: 7. oktober 2017 04:38:25 Til: Access List; SQLServerList; Development in Visual Studio Cc: Paul Hartland Emne: [dba-SQLServer] Free cloud database To all, Does anyone know of/recommend a decent free cloud database I can use even if a trial for a month or two while I try to test a few things, will be happy to pay if I decide to use it afterwards. Paul _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From gustav at cactus.dk Sun Oct 15 10:27:18 2017 From: gustav at cactus.dk (Gustav Brock) Date: Sun, 15 Oct 2017 15:27:18 +0000 Subject: [dba-VS] [dba-VB] C#, mantissa, math fun In-Reply-To: References: , Message-ID: Hi all I noticed, that this method will strip leading zeroes from the decimal part. For example, an input of 1234.056789 will return 56789 and not 056789. Thus, the result must be a string: double number = -1234.056789; string mantissa = string.Empty; decimal fraction = (decimal)number % 1; if (fraction != 0) { mantissa = Math.Abs(fraction).ToString().Substring(2); } Console.WriteLine(mantissa); Console.ReadKey(); // -> 056789 /gustav ________________________________________ Fra: dba-vb-bounces at databaseadvisors.com p? vegne af Gustav Brock Sendt: 30. august 2008 12:10:04 Til: dba-vb at databaseadvisors.com Emne: Re: [dba-VB] C#, mantissa, math fun Hi all (blush) ... if no decimals exist (number is an integer) that one-liner will fail. So check for zero decimals: double number = -1234.56789; int mantissa = 0; decimal fraction = (decimal)number % 1; if (fraction != 0) { mantissa = Convert.ToInt32(Math.Abs(fraction).ToString().Substring(2)); } /gustav >>> Gustav at cactus.dk 17-08-2008 17:13 >>> Hi all Delphi people know this as Fract, the decimal part of a decimal number. C# does not contain a direct method to extract that, so I thought of some smart math way to do so as I try too to avoid number handling by string conversion as it often turns into some "dirty" operation. By second thought you - as a human - easily can extract the mantissa but you do that by looking at the full number as a string. So why not ask the machine to do the same - and simple string handling is actually extremely fast for small strings like here, while raising a number to the power of something (which is a math method) is slower. So, inspired by this link: http://bytes.com/forum/thread563673.html I found this simple one-liner which handles both negative and positive numbers: double number = -1234.56789; int mantissa = Convert.ToInt32((Math.Abs((decimal)number) % 1).ToString().Substring(2)); mantissa -> 56789 Of course, if you expect to use it a lot, wrap it into a utility class. Still, I wonder if some clever byte manipulation method would exist. /gustav From gustav at cactus.dk Sun Oct 15 10:54:07 2017 From: gustav at cactus.dk (Gustav Brock) Date: Sun, 15 Oct 2017 15:54:07 +0000 Subject: [dba-VS] [dba-VB] C#, mantissa, math fun In-Reply-To: References: , Message-ID: Hi all I posted a method for this in C#. Finding the mantissa in VBA it could be like: ' Returns the mantissa of a decimal number as ' a string to preserve leading zeroes. ' ' Examples: ' Mantissa(1234.56789) -> "56789" ' Mantissa(-1234.56789) -> "56789" ' Mantissa(1234.056789) -> "056789" ' Mantissa(-1234.056789) -> "056789" ' Mantissa(123456789) -> "" ' ' 2017-10-15. Gustav Brock, Cactus Data ApS, CPH. ' Public Function Mantissa( _ ByVal Number As Double) _ As String Dim Result As String Dim Fraction As Variant Fraction = CDec(Number) - CDec(Fix(Number)) If Fraction <> 0 Then Result = Mid(Str(Abs(Fraction)), 3) End If Mantissa = Result End Function /gustav From gustav at cactus.dk Mon Oct 16 05:33:49 2017 From: gustav at cactus.dk (Gustav Brock) Date: Mon, 16 Oct 2017 10:33:49 +0000 Subject: [dba-VS] [dba-VB] C#, mantissa, math fun Message-ID: Hi all Oops, the parameter should be a Variant to take a Decimal value which can hold op to 28 decimals: ' Returns the mantissa of a decimal number as ' a string to preserve leading zeroes. ' ' Maximum returned length of mantissa is: ' Single: 8 ' Double: 16 ' Currency: 4 ' Decimal: 28 ' ' Examples: ' Mantissa(1234.56789) -> "56789" ' Mantissa(-1234.56789) -> "56789" ' Mantissa(1234.056789) -> "056789" ' Mantissa(-1234.056789) -> "056789" ' Mantissa(123456789) -> "" ' Mantissa(CDec("-0.0123456789012345678901234567")) -> "0123456789012345678901234567" ' Mantissa(CDbl("-0.0123456789012345678901234567")) -> "0123456789012346" ' ' 2017-10-16. Gustav Brock, Cactus Data ApS, CPH. ' Public Function Mantissa( _ ByVal Number As Variant) _ As String Dim Result As String Dim Fraction As Variant If IsNumeric(Number) Then ' Convert to Decimal to prevent scientific notation of doubles and singles. Fraction = CDec(Number) - Fix(CDec(Number)) If Fraction <> 0 Then Result = Mid(Str(Abs(Fraction)), 3) End If End If Mantissa = Result End Function /gustav -----Oprindelig meddelelse----- Fra: dba-VS [mailto:dba-vs-bounces at databaseadvisors.com] P? vegne af Gustav Brock Sendt: 15. oktober 2017 17:54 Til: Development in Visual Studio ; Access Developers discussion and problem solving Emne: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi all I posted a method for this in C#. Finding the mantissa in VBA it could be like: ' Returns the mantissa of a decimal number as ' a string to preserve leading zeroes. ' ' Examples: ' Mantissa(1234.56789) -> "56789" ' Mantissa(-1234.56789) -> "56789" ' Mantissa(1234.056789) -> "056789" ' Mantissa(-1234.056789) -> "056789" ' Mantissa(123456789) -> "" ' ' 2017-10-15. Gustav Brock, Cactus Data ApS, CPH. ' Public Function Mantissa( _ ByVal Number As Double) _ As String Dim Result As String Dim Fraction As Variant Fraction = CDec(Number) - CDec(Fix(Number)) If Fraction <> 0 Then Result = Mid(Str(Abs(Fraction)), 3) End If Mantissa = Result End Function /gustav _______________________________________________ dba-VS mailing list dba-VS at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vs http://www.databaseadvisors.com From accessd at shaw.ca Mon Oct 16 11:43:29 2017 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 16 Oct 2017 10:43:29 -0600 (MDT) Subject: [dba-VS] [dba-VB] C#, mantissa, math fun In-Reply-To: References: Message-ID: <163813623.517906390.1508172209023.JavaMail.zimbra@shaw.ca> Hi Gustav: Thanks for the update. I have a question about the return parameters. As it is possible to send any value to this function, how are values like strings or an empty value managed? Should the variable "Result" be initialized to a zero or have some other default value? Jim ----- Original Message ----- From: "Gustav Brock" To: "Development in Visual Studio" databaseadvisors.com>, "Access Developers discussion and problem solving" Sent: Monday, October 16, 2017 3:33:49 AM Subject: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi all Oops, the parameter should be a Variant to take a Decimal value which can hold op to 28 decimals: ' Returns the mantissa of a decimal number as ' a string to preserve leading zeroes. ' ' Maximum returned length of mantissa is: ' Single: 8 ' Double: 16 ' Currency: 4 ' Decimal: 28 ' ' Examples: ' Mantissa(1234.56789) -> "56789" ' Mantissa(-1234.56789) -> "56789" ' Mantissa(1234.056789) -> "056789" ' Mantissa(-1234.056789) -> "056789" ' Mantissa(123456789) -> "" ' Mantissa(CDec("-0.0123456789012345678901234567")) -> "0123456789012345678901234567" ' Mantissa(CDbl("-0.0123456789012345678901234567")) -> "0123456789012346" ' ' 2017-10-16. Gustav Brock, Cactus Data ApS, CPH. ' Public Function Mantissa( _ ByVal Number As Variant) _ As String Dim Result As String Dim Fraction As Variant If IsNumeric(Number) Then ' Convert to Decimal to prevent scientific notation of doubles and singles. Fraction = CDec(Number) - Fix(CDec(Number)) If Fraction <> 0 Then Result = Mid(Str(Abs(Fraction)), 3) End If End If Mantissa = Result End Function /gustav -----Oprindelig meddelelse----- Fra: dba-VS [mailto:dba-vs-bounces at databaseadvisors.com] P? vegne af Gustav Brock Sendt: 15. oktober 2017 17:54 Til: Development in Visual Studio databaseadvisors.com>; Access Developers discussion and problem solving Emne: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi all I posted a method for this in C#. Finding the mantissa in VBA it could be like: ' Returns the mantissa of a decimal number as ' a string to preserve leading zeroes. ' ' Examples: ' Mantissa(1234.56789) -> "56789" ' Mantissa(-1234.56789) -> "56789" ' Mantissa(1234.056789) -> "056789" ' Mantissa(-1234.056789) -> "056789" ' Mantissa(123456789) -> "" ' ' 2017-10-15. Gustav Brock, Cactus Data ApS, CPH. ' Public Function Mantissa( _ ByVal Number As Double) _ As String Dim Result As String Dim Fraction As Variant Fraction = CDec(Number) - CDec(Fix(Number)) If Fraction <> 0 Then Result = Mid(Str(Abs(Fraction)), 3) End If Mantissa = Result End Function /gustav _______________________________________________ dba-VS mailing list dba-VS at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vs http://www.databaseadvisors.com _______________________________________________ dba-VS mailing list dba-VS at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vs http://www.databaseadvisors.com From gustav at cactus.dk Mon Oct 16 12:08:03 2017 From: gustav at cactus.dk (Gustav Brock) Date: Mon, 16 Oct 2017 17:08:03 +0000 Subject: [dba-VS] C#, mantissa, math fun In-Reply-To: <163813623.517906390.1508172209023.JavaMail.zimbra@shaw.ca> References: , <163813623.517906390.1508172209023.JavaMail.zimbra@shaw.ca> Message-ID: Hi Jim I'm lazy, so the default value of variable Result - a zero length string - is returned if the passed parameter fails the IsNumeric check or if variable Fraction is zero. /gustav ________________________________________ Fra: dba-VS p? vegne af Jim Lawrence Sendt: 16. oktober 2017 18:43 Til: Development in Visual Studio Emne: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi Gustav: Thanks for the update. I have a question about the return parameters. As it is possible to send any value to this function, how are values like strings or an empty value managed? Should the variable "Result" be initialized to a zero or have some other default value? Jim ----- Original Message ----- From: "Gustav Brock" To: "Development in Visual Studio" databaseadvisors.com>, "Access Developers discussion and problem solving" Sent: Monday, October 16, 2017 3:33:49 AM Subject: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi all Oops, the parameter should be a Variant to take a Decimal value which can hold op to 28 decimals: ' Returns the mantissa of a decimal number as ' a string to preserve leading zeroes. ' ' Maximum returned length of mantissa is: ' Single: 8 ' Double: 16 ' Currency: 4 ' Decimal: 28 ' ' Examples: ' Mantissa(1234.56789) -> "56789" ' Mantissa(-1234.56789) -> "56789" ' Mantissa(1234.056789) -> "056789" ' Mantissa(-1234.056789) -> "056789" ' Mantissa(123456789) -> "" ' Mantissa(CDec("-0.0123456789012345678901234567")) -> "0123456789012345678901234567" ' Mantissa(CDbl("-0.0123456789012345678901234567")) -> "0123456789012346" ' ' 2017-10-16. Gustav Brock, Cactus Data ApS, CPH. ' Public Function Mantissa( _ ByVal Number As Variant) _ As String Dim Result As String Dim Fraction As Variant If IsNumeric(Number) Then ' Convert to Decimal to prevent scientific notation of doubles and singles. Fraction = CDec(Number) - Fix(CDec(Number)) If Fraction <> 0 Then Result = Mid(Str(Abs(Fraction)), 3) End If End If Mantissa = Result End Function /gustav -----Oprindelig meddelelse----- Fra: dba-VS [mailto:dba-vs-bounces at databaseadvisors.com] P? vegne af Gustav Brock Sendt: 15. oktober 2017 17:54 Til: Development in Visual Studio databaseadvisors.com>; Access Developers discussion and problem solving Emne: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi all I posted a method for this in C#. Finding the mantissa in VBA it could be like: ' Returns the mantissa of a decimal number as ' a string to preserve leading zeroes. ' ' Examples: ' Mantissa(1234.56789) -> "56789" ' Mantissa(-1234.56789) -> "56789" ' Mantissa(1234.056789) -> "056789" ' Mantissa(-1234.056789) -> "056789" ' Mantissa(123456789) -> "" ' ' 2017-10-15. Gustav Brock, Cactus Data ApS, CPH. ' Public Function Mantissa( _ ByVal Number As Double) _ As String Dim Result As String Dim Fraction As Variant Fraction = CDec(Number) - CDec(Fix(Number)) If Fraction <> 0 Then Result = Mid(Str(Abs(Fraction)), 3) End If Mantissa = Result End Function /gustav From accessd at shaw.ca Mon Oct 16 12:11:45 2017 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 16 Oct 2017 11:11:45 -0600 (MDT) Subject: [dba-VS] C#, mantissa, math fun In-Reply-To: References: <163813623.517906390.1508172209023.JavaMail.zimbra@shaw.ca> Message-ID: <766385187.517979795.1508173905125.JavaMail.zimbra@shaw.ca> Hi Gustav: I have always been really anal when it comes to programming as I have been bit so many times...it now a habit. So what projects are you now working on? Jim ----- Original Message ----- From: "Gustav Brock" To: "Development in Visual Studio" databaseadvisors.com> Sent: Monday, October 16, 2017 10:08:03 AM Subject: Re: [dba-VS] C#, mantissa, math fun Hi Jim I'm lazy, so the default value of variable Result - a zero length string - is returned if the passed parameter fails the IsNumeric check or if variable Fraction is zero. /gustav ________________________________________ Fra: dba-VS databaseadvisors.com> p? vegne af Jim Lawrence Sendt: 16. oktober 2017 18:43 Til: Development in Visual Studio Emne: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi Gustav: Thanks for the update. I have a question about the return parameters. As it is possible to send any value to this function, how are values like strings or an empty value managed? Should the variable "Result" be initialized to a zero or have some other default value? Jim ----- Original Message ----- From: "Gustav Brock" To: "Development in Visual Studio" databaseadvisors.com>, "Access Developers discussion and problem solving" Sent: Monday, October 16, 2017 3:33:49 AM Subject: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi all Oops, the parameter should be a Variant to take a Decimal value which can hold op to 28 decimals: ' Returns the mantissa of a decimal number as ' a string to preserve leading zeroes. ' ' Maximum returned length of mantissa is: ' Single: 8 ' Double: 16 ' Currency: 4 ' Decimal: 28 ' ' Examples: ' Mantissa(1234.56789) -> "56789" ' Mantissa(-1234.56789) -> "56789" ' Mantissa(1234.056789) -> "056789" ' Mantissa(-1234.056789) -> "056789" ' Mantissa(123456789) -> "" ' Mantissa(CDec("-0.0123456789012345678901234567")) -> "0123456789012345678901234567" ' Mantissa(CDbl("-0.0123456789012345678901234567")) -> "0123456789012346" ' ' 2017-10-16. Gustav Brock, Cactus Data ApS, CPH. ' Public Function Mantissa( _ ByVal Number As Variant) _ As String Dim Result As String Dim Fraction As Variant If IsNumeric(Number) Then ' Convert to Decimal to prevent scientific notation of doubles and singles. Fraction = CDec(Number) - Fix(CDec(Number)) If Fraction <> 0 Then Result = Mid(Str(Abs(Fraction)), 3) End If End If Mantissa = Result End Function /gustav -----Oprindelig meddelelse----- Fra: dba-VS [mailto:dba-vs-bounces at databaseadvisors.com] P? vegne af Gustav Brock Sendt: 15. oktober 2017 17:54 Til: Development in Visual Studio databaseadvisors.com>; Access Developers discussion and problem solving Emne: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi all I posted a method for this in C#. Finding the mantissa in VBA it could be like: ' Returns the mantissa of a decimal number as ' a string to preserve leading zeroes. ' ' Examples: ' Mantissa(1234.56789) -> "56789" ' Mantissa(-1234.56789) -> "56789" ' Mantissa(1234.056789) -> "056789" ' Mantissa(-1234.056789) -> "056789" ' Mantissa(123456789) -> "" ' ' 2017-10-15. Gustav Brock, Cactus Data ApS, CPH. ' Public Function Mantissa( _ ByVal Number As Double) _ As String Dim Result As String Dim Fraction As Variant Fraction = CDec(Number) - CDec(Fix(Number)) If Fraction <> 0 Then Result = Mid(Str(Abs(Fraction)), 3) End If Mantissa = Result End Function /gustav _______________________________________________ dba-VS mailing list dba-VS at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vs http://www.databaseadvisors.com From gustav at cactus.dk Mon Oct 16 12:52:28 2017 From: gustav at cactus.dk (Gustav Brock) Date: Mon, 16 Oct 2017 17:52:28 +0000 Subject: [dba-VS] C#, mantissa, math fun In-Reply-To: <766385187.517979795.1508173905125.JavaMail.zimbra@shaw.ca> References: <163813623.517906390.1508172209023.JavaMail.zimbra@shaw.ca> , <766385187.517979795.1508173905125.JavaMail.zimbra@shaw.ca> Message-ID: Hi Jim Right now I'm about converting three old Access 97 apps to Access 2016 with a SQL Server 2017 backend. Initially, it's quite easy: Convert FE and BE to Access 2000 and relink. Then convert these to Access 2016 and relink. Now, use SSMA to migrate the backend to SQL Server. Finally, relink FE to the SQL Server database via the SQL Server 13 driver. With minor changes, this runs directly with a local SQL Server. But if running across a WAN, the fun begins. However, this client will have a local SQL Server 2017 Express running, so it might very well stay at this step. I have also built a larger budgetting application in Excel for a TV production company linking actual data from their ERP system. This has no interface, so I had to build a conversion app (in C#) to link the old Access backend of the system directly and copy data to a local SQL Server - and push the data further on to Azure SQL. This is because the budget app has to run in Excel Online, thus no macros, neither access to "foreign" data sources, only Azure. This was a bit of a challenge, as I could only get Excel to connect to Azure SQL via OLEDB, and - because of no VBA - all "logic" had to be by formulas. I ended up to build the entire workbook, worksheets, tables, connections, table design, formulas, and the full graphic design including hyperlinks and table styles from code. To accomplish this was a major task, as so little useful code can be found; most code is GUI oriented and deals with selections, A1:G6 styling, no Named Ranges, and - in general - is sloppish and "good enough". Add to this the mediocre documentation of Excel VBA and you feel you are on your own. I ended up with a large library of both common and specific functions. By running a series of a dozen or so functions I can build the entire application in two steps from an empty workbook: First step creates all the connections and base tables. Then, due to a bug in Excel, Excel has to be closed completely and relaunched. Second step builds the entire application in twenty seconds. It looks quite impressive. Perhaps I should publish the work - if for nothing else to demonstrate how VBA could and should be handled in Excel. But I cannot find out where. Sadly, I have had too little time to program in C#, my favourite. I hope this will change now. /gustav ________________________________________ Fra: dba-VS p? vegne af Jim Lawrence Sendt: 16. oktober 2017 19:11 Til: Development in Visual Studio Emne: Re: [dba-VS] C#, mantissa, math fun Hi Gustav: I have always been really anal when it comes to programming as I have been bit so many times...it now a habit. So what projects are you now working on? Jim ----- Original Message ----- From: "Gustav Brock" To: "Development in Visual Studio" databaseadvisors.com> Sent: Monday, October 16, 2017 10:08:03 AM Subject: Re: [dba-VS] C#, mantissa, math fun Hi Jim I'm lazy, so the default value of variable Result - a zero length string - is returned if the passed parameter fails the IsNumeric check or if variable Fraction is zero. /gustav ________________________________________ Fra: dba-VS databaseadvisors.com> p? vegne af Jim Lawrence Sendt: 16. oktober 2017 18:43 Til: Development in Visual Studio Emne: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi Gustav: Thanks for the update. I have a question about the return parameters. As it is possible to send any value to this function, how are values like strings or an empty value managed? Should the variable "Result" be initialized to a zero or have some other default value? Jim ----- Original Message ----- From: "Gustav Brock" To: "Development in Visual Studio" databaseadvisors.com>, "Access Developers discussion and problem solving" Sent: Monday, October 16, 2017 3:33:49 AM Subject: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi all Oops, the parameter should be a Variant to take a Decimal value which can hold op to 28 decimals: ' Returns the mantissa of a decimal number as ' a string to preserve leading zeroes. ' ' Maximum returned length of mantissa is: ' Single: 8 ' Double: 16 ' Currency: 4 ' Decimal: 28 ' ' Examples: ' Mantissa(1234.56789) -> "56789" ' Mantissa(-1234.56789) -> "56789" ' Mantissa(1234.056789) -> "056789" ' Mantissa(-1234.056789) -> "056789" ' Mantissa(123456789) -> "" ' Mantissa(CDec("-0.0123456789012345678901234567")) -> "0123456789012345678901234567" ' Mantissa(CDbl("-0.0123456789012345678901234567")) -> "0123456789012346" ' ' 2017-10-16. Gustav Brock, Cactus Data ApS, CPH. ' Public Function Mantissa( _ ByVal Number As Variant) _ As String Dim Result As String Dim Fraction As Variant If IsNumeric(Number) Then ' Convert to Decimal to prevent scientific notation of doubles and singles. Fraction = CDec(Number) - Fix(CDec(Number)) If Fraction <> 0 Then Result = Mid(Str(Abs(Fraction)), 3) End If End If Mantissa = Result End Function /gustav -----Oprindelig meddelelse----- Fra: dba-VS [mailto:dba-vs-bounces at databaseadvisors.com] P? vegne af Gustav Brock Sendt: 15. oktober 2017 17:54 Til: Development in Visual Studio databaseadvisors.com>; Access Developers discussion and problem solving Emne: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi all I posted a method for this in C#. Finding the mantissa in VBA it could be like: ' Returns the mantissa of a decimal number as ' a string to preserve leading zeroes. ' ' Examples: ' Mantissa(1234.56789) -> "56789" ' Mantissa(-1234.56789) -> "56789" ' Mantissa(1234.056789) -> "056789" ' Mantissa(-1234.056789) -> "056789" ' Mantissa(123456789) -> "" ' ' 2017-10-15. Gustav Brock, Cactus Data ApS, CPH. ' Public Function Mantissa( _ ByVal Number As Double) _ As String Dim Result As String Dim Fraction As Variant Fraction = CDec(Number) - CDec(Fix(Number)) If Fraction <> 0 Then Result = Mid(Str(Abs(Fraction)), 3) End If Mantissa = Result End Function /gustav From accessd at shaw.ca Mon Oct 16 13:40:30 2017 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 16 Oct 2017 12:40:30 -0600 (MDT) Subject: [dba-VS] C#, mantissa, math fun In-Reply-To: References: <163813623.517906390.1508172209023.JavaMail.zimbra@shaw.ca> <766385187.517979795.1508173905125.JavaMail.zimbra@shaw.ca> Message-ID: <64786307.518193028.1508179230520.JavaMail.zimbra@shaw.ca> Hi Gustav: It sounds like you are doing some very exciting stuff. I have been sort of retired but once I start application development I am totally hyped.:-) I will be working on an Access xx conversion from MDB to MS SQL. (Might need your help at some time.) The current code is a mess with little documentation and with all sorts of product hacks that make the system very difficult to upgrade. After the database migration, the next part of the project will be to replace Access with a browser FE. It will first run as an intranet app but eventually it will be migrated to the internet. Right now, a friend and I, are working on an initial installation of a product called "Big Blue Button"...It is supposed to be replacing a $500K existing application. BBB is a huge open source application that is targeted towards local/distant-education but it would work equally as well as a company management tool. We got the program up and running in a Ubuntu 17.04 instance running on a MS Hyper-V server. It will probably take a good month of tests and then we deploy the system up to a DigitalOcean droplet and at one point a major roll-out. All very heady stuff. I will post the base BBB install over-view on the DBA-Tech list later today. Aside: It is no longer just being able to code but being able to secure a site. I find all the new security management that must be applied to all new application challenging. My friend's company may be hiring a tech solely for that purpose...an edge protection expert. Keep me posted on your progress. Jim ----- Original Message ----- From: "Gustav Brock" To: "Development in Visual Studio" databaseadvisors.com> Sent: Monday, October 16, 2017 10:52:28 AM Subject: Re: [dba-VS] C#, mantissa, math fun Hi Jim Right now I'm about converting three old Access 97 apps to Access 2016 with a SQL Server 2017 backend. Initially, it's quite easy: Convert FE and BE to Access 2000 and relink. Then convert these to Access 2016 and relink. Now, use SSMA to migrate the backend to SQL Server. Finally, relink FE to the SQL Server database via the SQL Server 13 driver. With minor changes, this runs directly with a local SQL Server. But if running across a WAN, the fun begins. However, this client will have a local SQL Server 2017 Express running, so it might very well stay at this step. I have also built a larger budgetting application in Excel for a TV production company linking actual data from their ERP system. This has no interface, so I had to build a conversion app (in C#) to link the old Access backend of the system directly and copy data to a local SQL Server - and push the data further on to Azure SQL. This is because the budget app has to run in Excel Online, thus no macros, neither access to "foreign" data sources, only Azure. This was a bit of a challenge, as I could only get Excel to connect to Azure SQL via OLEDB, and - because of no VBA - all "logic" had to be by formulas. I ended up to build the entire workbook, worksheets, tables, connections, table design, formulas, and the full graphic design including hyperlinks and table styles from code. To accomplish this was a major task, as so little useful code can be found; most code is GUI oriented and deals with selections, A1:G6 styling, no Named Ranges, and - in general - is sloppish and "good enough". Add to this the mediocre documentation of Excel VBA and you feel you are on your own. I ended up with a large library of both common and specific functions. By running a series of a dozen or so functions I can build the entire application in two steps from an empty workbook: First step creates all the connections and base tables. Then, due to a bug in Excel, Excel has to be closed completely and relaunched. Second step builds the entire application in twenty seconds. It looks quite impressive. Perhaps I should publish the work - if for nothing else to demonstrate how VBA could and should be handled in Excel. But I cannot find out where. Sadly, I have had too little time to program in C#, my favourite. I hope this will change now. /gustav ________________________________________ Fra: dba-VS databaseadvisors.com> p? vegne af Jim Lawrence Sendt: 16. oktober 2017 19:11 Til: Development in Visual Studio Emne: Re: [dba-VS] C#, mantissa, math fun Hi Gustav: I have always been really anal when it comes to programming as I have been bit so many times...it now a habit. So what projects are you now working on? Jim ----- Original Message ----- From: "Gustav Brock" To: "Development in Visual Studio" databaseadvisors.com> Sent: Monday, October 16, 2017 10:08:03 AM Subject: Re: [dba-VS] C#, mantissa, math fun Hi Jim I'm lazy, so the default value of variable Result - a zero length string - is returned if the passed parameter fails the IsNumeric check or if variable Fraction is zero. /gustav ________________________________________ Fra: dba-VS databaseadvisors.com> p? vegne af Jim Lawrence Sendt: 16. oktober 2017 18:43 Til: Development in Visual Studio Emne: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi Gustav: Thanks for the update. I have a question about the return parameters. As it is possible to send any value to this function, how are values like strings or an empty value managed? Should the variable "Result" be initialized to a zero or have some other default value? Jim ----- Original Message ----- From: "Gustav Brock" To: "Development in Visual Studio" databaseadvisors.com>, "Access Developers discussion and problem solving" Sent: Monday, October 16, 2017 3:33:49 AM Subject: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi all Oops, the parameter should be a Variant to take a Decimal value which can hold op to 28 decimals: ' Returns the mantissa of a decimal number as ' a string to preserve leading zeroes. ' ' Maximum returned length of mantissa is: ' Single: 8 ' Double: 16 ' Currency: 4 ' Decimal: 28 ' ' Examples: ' Mantissa(1234.56789) -> "56789" ' Mantissa(-1234.56789) -> "56789" ' Mantissa(1234.056789) -> "056789" ' Mantissa(-1234.056789) -> "056789" ' Mantissa(123456789) -> "" ' Mantissa(CDec("-0.0123456789012345678901234567")) -> "0123456789012345678901234567" ' Mantissa(CDbl("-0.0123456789012345678901234567")) -> "0123456789012346" ' ' 2017-10-16. Gustav Brock, Cactus Data ApS, CPH. ' Public Function Mantissa( _ ByVal Number As Variant) _ As String Dim Result As String Dim Fraction As Variant If IsNumeric(Number) Then ' Convert to Decimal to prevent scientific notation of doubles and singles. Fraction = CDec(Number) - Fix(CDec(Number)) If Fraction <> 0 Then Result = Mid(Str(Abs(Fraction)), 3) End If End If Mantissa = Result End Function /gustav -----Oprindelig meddelelse----- Fra: dba-VS [mailto:dba-vs-bounces at databaseadvisors.com] P? vegne af Gustav Brock Sendt: 15. oktober 2017 17:54 Til: Development in Visual Studio databaseadvisors.com>; Access Developers discussion and problem solving Emne: Re: [dba-VS] [dba-VB] C#, mantissa, math fun Hi all I posted a method for this in C#. Finding the mantissa in VBA it could be like: ' Returns the mantissa of a decimal number as ' a string to preserve leading zeroes. ' ' Examples: ' Mantissa(1234.56789) -> "56789" ' Mantissa(-1234.56789) -> "56789" ' Mantissa(1234.056789) -> "056789" ' Mantissa(-1234.056789) -> "056789" ' Mantissa(123456789) -> "" ' ' 2017-10-15. Gustav Brock, Cactus Data ApS, CPH. ' Public Function Mantissa( _ ByVal Number As Double) _ As String Dim Result As String Dim Fraction As Variant Fraction = CDec(Number) - CDec(Fix(Number)) If Fraction <> 0 Then Result = Mid(Str(Abs(Fraction)), 3) End If Mantissa = Result End Function /gustav _______________________________________________ dba-VS mailing list dba-VS at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vs http://www.databaseadvisors.com From gustav at cactus.dk Tue Oct 17 02:39:40 2017 From: gustav at cactus.dk (Gustav Brock) Date: Tue, 17 Oct 2017 07:39:40 +0000 Subject: [dba-VS] C#, mantissa, math fun Message-ID: Hi Jim It's a strange kind of retirement you practice. /gustav -----Oprindelig meddelelse----- Fra: dba-VS [mailto:dba-vs-bounces at databaseadvisors.com] P? vegne af Jim Lawrence Sendt: 16. oktober 2017 20:41 Til: Development in Visual Studio Emne: Re: [dba-VS] C#, mantissa, math fun Hi Gustav: It sounds like you are doing some very exciting stuff. I have been sort of retired but once I start application development I am totally hyped.:-) I will be working on an Access xx conversion from MDB to MS SQL. (Might need your help at some time.) The current code is a mess with little documentation and with all sorts of product hacks that make the system very difficult to upgrade. After the database migration, the next part of the project will be to replace Access with a browser FE. It will first run as an intranet app but eventually it will be migrated to the internet. Right now, a friend and I, are working on an initial installation of a product called "Big Blue Button"...It is supposed to be replacing a $500K existing application. BBB is a huge open source application that is targeted towards local/distant-education but it would work equally as well as a company management tool. We got the program up and running in a Ubuntu 17.04 instance running on a MS Hyper-V server. It will probably take a good month of tests and then we deploy the system up to a DigitalOcean droplet and at one point a major roll-out. All very heady stuff. I will post the base BBB install over-view on the DBA-Tech list later today. Aside: It is no longer just being able to code but being able to secure a site. I find all the new security management that must be applied to all new application challenging. My friend's company may be hiring a tech solely for that purpose...an edge protection expert. Keep me posted on your progress. Jim ----- Original Message ----- From: "Gustav Brock" To: "Development in Visual Studio" databaseadvisors.com> Sent: Monday, October 16, 2017 10:52:28 AM Subject: Re: [dba-VS] C#, mantissa, math fun Hi Jim Right now I'm about converting three old Access 97 apps to Access 2016 with a SQL Server 2017 backend. Initially, it's quite easy: Convert FE and BE to Access 2000 and relink. Then convert these to Access 2016 and relink. Now, use SSMA to migrate the backend to SQL Server. Finally, relink FE to the SQL Server database via the SQL Server 13 driver. With minor changes, this runs directly with a local SQL Server. But if running across a WAN, the fun begins. However, this client will have a local SQL Server 2017 Express running, so it might very well stay at this step. I have also built a larger budgetting application in Excel for a TV production company linking actual data from their ERP system. This has no interface, so I had to build a conversion app (in C#) to link the old Access backend of the system directly and copy data to a local SQL Server - and push the data further on to Azure SQL. This is because the budget app has to run in Excel Online, thus no macros, neither access to "foreign" data sources, only Azure. This was a bit of a challenge, as I could only get Excel to connect to Azure SQL via OLEDB, and - because of no VBA - all "logic" had to be by formulas. I ended up to build the entire workbook, worksheets, tables, connections, table design, formulas, and the full graphic design including hyperlinks and table styles from code. To accomplish this was a major task, as so little useful code can be found; most code is GUI oriented and deals with selections, A1:G6 styling, no Named Ranges, and - in general - is sloppish and "good enough". Add to this the mediocre documentation of Excel VBA and you feel you are on your own. I ended up with a large library of both common and specific functions. By running a series of a dozen or so functions I can build the entire application in two steps from an empty workbook: First step creates all the connections and base tables. Then, due to a bug in Excel, Excel has to be closed completely and relaunched. Second step builds the entire application in twenty seconds. It looks quite impressive. Perhaps I should publish the work - if for nothing else to demonstrate how VBA could and should be handled in Excel. But I cannot find out where. Sadly, I have had too little time to program in C#, my favourite. I hope this will change now. /gustav ________________________________________ Fra: dba-VS databaseadvisors.com> p? vegne af Jim Lawrence Sendt: 16. oktober 2017 19:11 Til: Development in Visual Studio Emne: Re: [dba-VS] C#, mantissa, math fun Hi Gustav: I have always been really anal when it comes to programming as I have been bit so many times...it now a habit. So what projects are you now working on? Jim From accessd at shaw.ca Tue Oct 17 10:55:15 2017 From: accessd at shaw.ca (Jim Lawrence) Date: Tue, 17 Oct 2017 09:55:15 -0600 (MDT) Subject: [dba-VS] C#, mantissa, math fun In-Reply-To: References: Message-ID: <955465104.520544373.1508255715098.JavaMail.zimbra@shaw.ca> Hi Gustav: If you are planning on retiring soon what are your plans? Who is going to take over your business and do it as well as you have? Will your clients let you retire? OTOH, you love tech and there is so much new tech happening every day how will you be able to leave it all that behind? I don't go looking for contracts but friends, still, in the business, ex-clients call me on occasion and even next door neighbours call. Jim ----- Original Message ----- From: "Gustav Brock" To: "Development in Visual Studio" databaseadvisors.com> Sent: Tuesday, October 17, 2017 12:39:40 AM Subject: Re: [dba-VS] C#, mantissa, math fun Hi Jim It's a strange kind of retirement you practice. /gustav -----Oprindelig meddelelse----- Fra: dba-VS [mailto:dba-vs-bounces at databaseadvisors.com] P? vegne af Jim Lawrence Sendt: 16. oktober 2017 20:41 Til: Development in Visual Studio databaseadvisors.com> Emne: Re: [dba-VS] C#, mantissa, math fun Hi Gustav: It sounds like you are doing some very exciting stuff. I have been sort of retired but once I start application development I am totally hyped.:-) I will be working on an Access xx conversion from MDB to MS SQL. (Might need your help at some time.) The current code is a mess with little documentation and with all sorts of product hacks that make the system very difficult to upgrade. After the database migration, the next part of the project will be to replace Access with a browser FE. It will first run as an intranet app but eventually it will be migrated to the internet. Right now, a friend and I, are working on an initial installation of a product called "Big Blue Button"...It is supposed to be replacing a $500K existing application. BBB is a huge open source application that is targeted towards local/distant-education but it would work equally as well as a company management tool. We got the program up and running in a Ubuntu 17.04 instance running on a MS Hyper-V server. It will probably take a good month of tests and then we deploy the system up to a DigitalOcean droplet and at one point a major roll-out. All very heady stuff. I will post the base BBB install over-view on the DBA-Tech list later today. Aside: It is no longer just being able to code but being able to secure a site. I find all the new security management that must be applied to all new application challenging. My friend's company may be hiring a tech solely for that purpose...an edge protection expert. Keep me posted on your progress. Jim ----- Original Message ----- From: "Gustav Brock" To: "Development in Visual Studio" databaseadvisors.com> Sent: Monday, October 16, 2017 10:52:28 AM Subject: Re: [dba-VS] C#, mantissa, math fun Hi Jim Right now I'm about converting three old Access 97 apps to Access 2016 with a SQL Server 2017 backend. Initially, it's quite easy: Convert FE and BE to Access 2000 and relink. Then convert these to Access 2016 and relink. Now, use SSMA to migrate the backend to SQL Server. Finally, relink FE to the SQL Server database via the SQL Server 13 driver. With minor changes, this runs directly with a local SQL Server. But if running across a WAN, the fun begins. However, this client will have a local SQL Server 2017 Express running, so it might very well stay at this step. I have also built a larger budgetting application in Excel for a TV production company linking actual data from their ERP system. This has no interface, so I had to build a conversion app (in C#) to link the old Access backend of the system directly and copy data to a local SQL Server - and push the data further on to Azure SQL. This is because the budget app has to run in Excel Online, thus no macros, neither access to "foreign" data sources, only Azure. This was a bit of a challenge, as I could only get Excel to connect to Azure SQL via OLEDB, and - because of no VBA - all "logic" had to be by formulas. I ended up to build the entire workbook, worksheets, tables, connections, table design, formulas, and the full graphic design including hyperlinks and table styles from code. To accomplish this was a major task, as so little useful code can be found; most code is GUI oriented and deals with selections, A1:G6 styling, no Named Ranges, and - in general - is sloppish and "good enough". Add to this the mediocre documentation of Excel VBA and you feel you are on your own. I ended up with a large library of both common and specific functions. By running a series of a dozen or so functions I can build the entire application in two steps from an empty workbook: First step creates all the connections and base tables. Then, due to a bug in Excel, Excel has to be closed completely and relaunched. Second step builds the entire application in twenty seconds. It looks quite impressive. Perhaps I should publish the work - if for nothing else to demonstrate how VBA could and should be handled in Excel. But I cannot find out where. Sadly, I have had too little time to program in C#, my favourite. I hope this will change now. /gustav From mcp2004 at mail.ru Thu Oct 26 00:46:00 2017 From: mcp2004 at mail.ru (=?UTF-8?B?U2FsYWtoZXRkaW5vdiBTaGFtaWw=?=) Date: Thu, 26 Oct 2017 08:46:00 +0300 Subject: [dba-VS] =?utf-8?q?Printing_=27Code_128_A=27_Barcode_Labels?= Message-ID: <1508996760.916964914@f169.i.mail.ru> Hi All -- I have to print 'Code 128A' barcode labels in one of my customers C# applications' reports. Do you know any third-party tools lighter than LEADTools ( https://www.leadtools.com/sdk/barcode-pro ) to solve my task? FYI: I have googled and I have found several solutions but all of them look a bit ovewrpriced for a single task of just printing barcode labels. There seems to be also a free solution (https://www.codeproject.com/Articles/14409/GenCode-A-Code-Barcode-Generator) but I'm not sure it will be useful for my case where I'll have to print several labels in two columns in one A4 page. Thank you. -- Shamil From df.waters at outlook.com Thu Oct 26 07:46:34 2017 From: df.waters at outlook.com (Dan Waters) Date: Thu, 26 Oct 2017 12:46:34 +0000 Subject: [dba-VS] Printing 'Code 128 A' Barcode Labels In-Reply-To: <1508996760.916964914@f169.i.mail.ru> References: <1508996760.916964914@f169.i.mail.ru> Message-ID: Hi Shamil, I've never used barcodes. But I do remember some discussion on barcodes in the Access-D. Perhaps someone there would have some thoughts. Good Luck! Dan -----Original Message----- From: dba-VS [mailto:dba-vs-bounces at databaseadvisors.com] On Behalf Of Salakhetdinov Shamil via dba-VS Sent: October 26, 2017 00:46 To: Development in Visual Studio Cc: Salakhetdinov Shamil Subject: [dba-VS] Printing 'Code 128 A' Barcode Labels Hi All -- I have to print 'Code 128A' barcode labels in one of my customers C# applications' reports. Do you know any third-party tools lighter than LEADTools ( https://www.leadtools.com/sdk/barcode-pro ) to solve my task? FYI: I have googled and I have found several solutions but all of them look a bit ovewrpriced for a single task of just printing barcode labels. There seems to be also a free solution (https://www.codeproject.com/Articles/14409/GenCode-A-Code-Barcode-Generator) but I'm not sure it will be useful for my case where I'll have to print several labels in two columns in one A4 page. Thank you. -- Shamil _______________________________________________ dba-VS mailing list dba-VS at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vs http://www.databaseadvisors.com From stuart at lexacorp.com.pg Thu Oct 26 20:11:50 2017 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Fri, 27 Oct 2017 11:11:50 +1000 Subject: [dba-VS] Printing 'Code 128 A' Barcode Labels In-Reply-To: <1508996760.916964914@f169.i.mail.ru> References: <1508996760.916964914@f169.i.mail.ru> Message-ID: <59F287D6.4732.42A3C8B9@stuart.lexacorp.com.pg> On 26 Oct 2017 at 8:46, Salakhetdinov Shamil via dba wrote: > > Hi All -- > > I have to print 'Code 128A' barcode labels in one of my customers C# > applications' reports. Do you know any third-party tools lighter than > LEADTools ( https://www.leadtools.com/sdk/barcode-pro ) to solve my > task? > > FYI: I have googled and I have found several solutions but all of them > look a bit ovewrpriced for a single task of just printing barcode > labels. > > There seems to be also a free solution > (https://www.codeproject.com/Articles/14409/GenCode-A-Code-Barcode-Gen > erator) but I'm not sure it will be useful for my case where I'll have > to print several labels in two columns in one A4 page. > Does hit have to be Subset A? (i.e. with ASCII Control characters). If you are only after letters and numbers, then the simplest solution is to download a Code128 font and write a function to covert your data to an appropriate string. If you need to use A, it gets a bit more tricky. Here's a Code 128 TTF: https://d13ot9o61jdzpp.cloudfront.net/files/code128.ttf And here's a VBA function to convert a string to a Code128 (B or C) string. (I'm sure you can covert it to C# fairly easily) Public Function Code128(SourceString As String) 'Written by Philip Treacy, Feb 2014 'http://www.myonlinetraininghub.com/create-barcodes-with-excel-vba 'This code is not guaranteed to be error free. No warranty is implied or expressed. Use at your own risk and carry out your own testing 'This function is governed by the GNU Lesser General Public License (GNU LGPL) Ver 3 'Input Parameters : A string 'Return : 1. An encoded string which produces a bar code when dispayed using the CODE128.TTF font ' 2. An empty string if the input parameter contains invalid characters Dim Counter As Integer Dim CheckSum As Long Dim mini As Integer Dim dummy As Integer Dim UseTableB As Boolean Dim Code128_Barcode As String If Len(SourceString) > 0 Then 'Check for valid characters For Counter = 1 To Len(SourceString) Select Case Asc(Mid(SourceString, Counter, 1)) Case 32 To 126, 203 Case Else MsgBox "Invalid character in barcode string." & vbCrLf & vbCrLf & "Please only use standard ASCII characters", vbCritical Code128 = "" Exit Function End Select Next Code128_Barcode = "" UseTableB = True Counter = 1 Do While Counter <= Len(SourceString) If UseTableB Then 'Check if we can switch to Table C mini = IIf(Counter = 1 Or Counter + 3 = Len(SourceString), 4, 6) GoSub testnum If mini% < 0 Then 'Use Table C If Counter = 1 Then Code128_Barcode = Chr(205) Else 'Switch to table C Code128_Barcode = Code128_Barcode & Chr(199) End If UseTableB = False Else If Counter = 1 Then Code128_Barcode = Chr(204) 'Starting with table B End If End If If Not UseTableB Then 'We are using Table C, try to process 2 digits mini% = 2 GoSub testnum If mini% < 0 Then 'OK for 2 digits, process it dummy% = Val(Mid(SourceString, Counter, 2)) dummy% = IIf(dummy% < 95, dummy% + 32, dummy% + 100) Code128_Barcode = Code128_Barcode & Chr(dummy%) Counter = Counter + 2 Else 'We haven't got 2 digits, switch to Table B Code128_Barcode = Code128_Barcode & Chr(200) UseTableB = True End If End If If UseTableB Then 'Process 1 digit with table B Code128_Barcode = Code128_Barcode & Mid(SourceString, Counter, 1) Counter = Counter + 1 End If Loop 'Calculation of the checksum For Counter = 1 To Len(Code128_Barcode) dummy% = Asc(Mid(Code128_Barcode, Counter, 1)) dummy% = IIf(dummy% < 127, dummy% - 32, dummy% - 100) If Counter = 1 Then CheckSum& = dummy% CheckSum& = (CheckSum& + (Counter - 1) * dummy%) Mod 103 Next 'Calculation of the checksum ASCII code CheckSum& = IIf(CheckSum& < 95, CheckSum& + 32, CheckSum& + 100) 'Add the checksum and the STOP Code128_Barcode = Code128_Barcode & Chr(CheckSum&) & Chr$(206) End If Code128 = Code128_Barcode Exit Function testnum: 'if the mini% characters from Counter are numeric, then mini%=0 mini% = mini% - 1 If Counter + mini% <= Len(SourceString) Then Do While mini% >= 0 If Asc(Mid(SourceString, Counter + mini%, 1)) < 48 Or Asc(Mid(SourceString, Counter + mini%, 1)) > 57 Then Exit Do mini% = mini% - 1 Loop End If Return End Function From accessd at shaw.ca Fri Oct 27 16:00:23 2017 From: accessd at shaw.ca (Jim Lawrence) Date: Fri, 27 Oct 2017 15:00:23 -0600 (MDT) Subject: [dba-VS] Printing 'Code 128 A' Barcode Labels In-Reply-To: <1508996760.916964914@f169.i.mail.ru> References: <1508996760.916964914@f169.i.mail.ru> Message-ID: <366957820.548549016.1509138023204.JavaMail.zimbra@shaw.ca> Hi Shamil: I have heard from a friend that a product named Zint is a good barcode create/print app that can be inserted in most applications. It is Open Source and has been ported from C to C#. https://sourceforge.net/projects/zintnet/ ...and http://www.zint.org.uk/ and https://zint.github.io/ You may have to do a little digging and maybe a little hacking but it all seems to be there. Jim ----- Original Message ----- From: "Development in Visual Studio" To: "Development in Visual Studio" Cc: "Salakhetdinov Shamil" Sent: Wednesday, October 25, 2017 10:46:00 PM Subject: [dba-VS] Printing 'Code 128 A' Barcode Labels Hi All -- I have to print 'Code 128A' barcode labels in one of my customers C# applications' reports. Do you know any third-party tools lighter than LEADTools ( https://www.leadtools.com/sdk/barcode-pro ) to solve my task? FYI: I have googled and I have found several solutions but all of them look a bit ovewrpriced for a single task of just printing barcode labels. There seems to be also a free solution (https://www.codeproject.com/Articles/14409/GenCode-A-Code-Barcode-Generator) but I'm not sure it will be useful for my case where I'll have to print several labels in two columns in one A4 page. Thank you. -- Shamil _______________________________________________ dba-VS mailing list dba-VS at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vs http://www.databaseadvisors.com From accessd at shaw.ca Fri Oct 27 17:57:54 2017 From: accessd at shaw.ca (Jim Lawrence) Date: Fri, 27 Oct 2017 16:57:54 -0600 (MDT) Subject: [dba-VS] Printing 'Code 128 A' Barcode Labels In-Reply-To: <59F287D6.4732.42A3C8B9@stuart.lexacorp.com.pg> References: <1508996760.916964914@f169.i.mail.ru> <59F287D6.4732.42A3C8B9@stuart.lexacorp.com.pg> Message-ID: <1655915000.548833441.1509145074477.JavaMail.zimbra@shaw.ca> Interesting. Does it work? Jim ----- Original Message ----- From: "stuart" To: "Development in Visual Studio" Sent: Thursday, October 26, 2017 6:11:50 PM Subject: Re: [dba-VS] Printing 'Code 128 A' Barcode Labels On 26 Oct 2017 at 8:46, Salakhetdinov Shamil via dba wrote: > > Hi All -- > > I have to print 'Code 128A' barcode labels in one of my customers C# > applications' reports. Do you know any third-party tools lighter than > LEADTools ( https://www.leadtools.com/sdk/barcode-pro ) to solve my > task? > > FYI: I have googled and I have found several solutions but all of them > look a bit ovewrpriced for a single task of just printing barcode > labels. > > There seems to be also a free solution > (https://www.codeproject.com/Articles/14409/GenCode-A-Code-Barcode-Gen > erator) but I'm not sure it will be useful for my case where I'll have > to print several labels in two columns in one A4 page. > Does hit have to be Subset A? (i.e. with ASCII Control characters). If you are only after letters and numbers, then the simplest solution is to download a Code128 font and write a function to covert your data to an appropriate string. If you need to use A, it gets a bit more tricky. Here's a Code 128 TTF: https://d13ot9o61jdzpp.cloudfront.net/files/code128.ttf And here's a VBA function to convert a string to a Code128 (B or C) string. (I'm sure you can covert it to C# fairly easily) Public Function Code128(SourceString As String) 'Written by Philip Treacy, Feb 2014 'http://www.myonlinetraininghub.com/create-barcodes-with-excel-vba 'This code is not guaranteed to be error free. No warranty is implied or expressed. Use at your own risk and carry out your own testing 'This function is governed by the GNU Lesser General Public License (GNU LGPL) Ver 3 'Input Parameters : A string 'Return : 1. An encoded string which produces a bar code when dispayed using the CODE128.TTF font ' 2. An empty string if the input parameter contains invalid characters Dim Counter As Integer Dim CheckSum As Long Dim mini As Integer Dim dummy As Integer Dim UseTableB As Boolean Dim Code128_Barcode As String If Len(SourceString) > 0 Then 'Check for valid characters For Counter = 1 To Len(SourceString) Select Case Asc(Mid(SourceString, Counter, 1)) Case 32 To 126, 203 Case Else MsgBox "Invalid character in barcode string." & vbCrLf & vbCrLf & "Please only use standard ASCII characters", vbCritical Code128 = "" Exit Function End Select Next Code128_Barcode = "" UseTableB = True Counter = 1 Do While Counter <= Len(SourceString) If UseTableB Then 'Check if we can switch to Table C mini = IIf(Counter = 1 Or Counter + 3 = Len(SourceString), 4, 6) GoSub testnum If mini% < 0 Then 'Use Table C If Counter = 1 Then Code128_Barcode = Chr(205) Else 'Switch to table C Code128_Barcode = Code128_Barcode & Chr(199) End If UseTableB = False Else If Counter = 1 Then Code128_Barcode = Chr(204) 'Starting with table B End If End If If Not UseTableB Then 'We are using Table C, try to process 2 digits mini% = 2 GoSub testnum If mini% < 0 Then 'OK for 2 digits, process it dummy% = Val(Mid(SourceString, Counter, 2)) dummy% = IIf(dummy% < 95, dummy% + 32, dummy% + 100) Code128_Barcode = Code128_Barcode & Chr(dummy%) Counter = Counter + 2 Else 'We haven't got 2 digits, switch to Table B Code128_Barcode = Code128_Barcode & Chr(200) UseTableB = True End If End If If UseTableB Then 'Process 1 digit with table B Code128_Barcode = Code128_Barcode & Mid(SourceString, Counter, 1) Counter = Counter + 1 End If Loop 'Calculation of the checksum For Counter = 1 To Len(Code128_Barcode) dummy% = Asc(Mid(Code128_Barcode, Counter, 1)) dummy% = IIf(dummy% < 127, dummy% - 32, dummy% - 100) If Counter = 1 Then CheckSum& = dummy% CheckSum& = (CheckSum& + (Counter - 1) * dummy%) Mod 103 Next 'Calculation of the checksum ASCII code CheckSum& = IIf(CheckSum& < 95, CheckSum& + 32, CheckSum& + 100) 'Add the checksum and the STOP Code128_Barcode = Code128_Barcode & Chr(CheckSum&) & Chr$(206) End If Code128 = Code128_Barcode Exit Function testnum: 'if the mini% characters from Counter are numeric, then mini%=0 mini% = mini% - 1 If Counter + mini% <= Len(SourceString) Then Do While mini% >= 0 If Asc(Mid(SourceString, Counter + mini%, 1)) < 48 Or Asc(Mid(SourceString, Counter + mini%, 1)) > 57 Then Exit Do mini% = mini% - 1 Loop End If Return End Function _______________________________________________ dba-VS mailing list dba-VS at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vs http://www.databaseadvisors.com From mcp2004 at mail.ru Fri Oct 27 19:38:18 2017 From: mcp2004 at mail.ru (=?UTF-8?B?U2FsYWtoZXRkaW5vdiBTaGFtaWw=?=) Date: Sat, 28 Oct 2017 03:38:18 +0300 Subject: [dba-VS] =?utf-8?q?Printing_=27Code_128_A=27_Barcode_Labels?= In-Reply-To: <59F287D6.4732.42A3C8B9@stuart.lexacorp.com.pg> References: <1508996760.916964914@f169.i.mail.ru> <59F287D6.4732.42A3C8B9@stuart.lexacorp.com.pg> Message-ID: <1509151098.41783184@f58.i.mail.ru> Hi Stuart -- Yes, only ASCII uppercase letters and numbers from 'Code 128 A' subset will be used in my barcode labels. I have just tried TTF and sample code you've provided to see if I will get proper barcodes' graphics for the sample source letters/numbers. Here is one example:? https://barcode.tec-it.com/en/Code128?data=X001IEM7L3 ? When I used VBA code with XL it generated text string ?X001IEM7L3e? for the source text string X001IEM7L3 and the resulting graphics weren't quite correct. Also TTF font max? size is 72 and width can't be adjusted AFAIS - this can be a "stopper" issue for using the custom code and TTF font. Here is another C# solution, which seems to be working well for my first tests:? https://www.codeproject.com/Articles/14409/GenCode-A-Code-Barcode-Generator ?. For my sample string it generates the folowing Hex codes: 68, 38, 10, 10, 11, 29, 25, 2D, 17, 2C, 13, 45, 6A and draws a proper barcode graphics equal to? https://barcode.tec-it.com/en/Code128?data=X001IEM7L3 ? Still to test more sample cases and find a way how to draw/print several bar codes on one A4-size page - this code https://www.codeproject.com/Tips/733680/Printing-and-Previewing-multiple-pages-in-Csharp ? will probably have to be also used. Also, I have just tried to use Code 128 TTF font with VS2017 WinForm's TextBox and it refused to use it reporting that "Only TTF fonts are supported". Strange. MS Excel does accept this Code 128 TTF font. Thank you. -- Shamil >Friday, October 27, 2017 4:13 AM +03:00 from "Stuart McLachlan" : > >On 26 Oct 2017 at 8:46, Salakhetdinov Shamil via dba wrote: > >> >> Hi All -- >> >> I have to print 'Code 128A' barcode labels in one of my customers C# >> applications' reports. Do you know any third-party tools lighter than >> LEADTools ( https://www.leadtools.com/sdk/barcode-pro ) to solve my >> task? >> >> FYI: I have googled and I have found several solutions but all of them >> look a bit ovewrpriced for a single task of just printing barcode >> labels. >> >> There seems to be also a free solution >> ( https://www.codeproject.com/Articles/14409/GenCode-A-Code-Barcode-Gen >> erator) but I'm not sure it will be useful for my case where I'll have >> to print several labels in two columns in one A4 page. >> >Does hit have to be Subset A? (i.e. with ASCII Control characters). If you are only after >letters and numbers, then the simplest solution is to download a Code128 font and write a >function to covert your data to an appropriate string. > >If you need to use A, it gets a bit more tricky. > >Here's a Code 128 TTF: https://d13ot9o61jdzpp.cloudfront.net/files/code128.ttf > >And here's a VBA function to convert a string to a Code128 (B or C) string. (I'm sure you can >covert it to C# fairly easily) > >Public Function Code128(SourceString As String) <<< skipped >>> > https://www.codeproject.com/Tips/733680/Printing-and-Previewing-multiple-pages-in-Csharp From mcp2004 at mail.ru Sun Oct 29 05:46:50 2017 From: mcp2004 at mail.ru (=?UTF-8?B?U2FsYWtoZXRkaW5vdiBTaGFtaWw=?=) Date: Sun, 29 Oct 2017 13:46:50 +0300 Subject: [dba-VS] =?utf-8?q?Printing_=27Code_128_A=27_Barcode_Labels?= In-Reply-To: References: <1508996760.916964914@f169.i.mail.ru> Message-ID: <1509274010.273230761@f211.i.mail.ru> Hi Dan et al -- As I have already noticed in this thread the following article and its code worked well/helped to solve my business task https://www.codeproject.com/Articles/14409/GenCode-A-Code-Barcode-Generator ? It was a foundation of the solution and I have solved the task of printing several barcode labels on a page by "activating my brain cells" ;) - by writing my custom code, which is currently looking too ugly to post it here as it was a result of "quick & dirty" coding on the last night/this early morning after two days of intensive programming of the other tasks... Thanks for everybody who participated in this thread discussion! -- Shamil >Thursday, October 26, 2017 3:48 PM +03:00 from Dan Waters : > >Hi Shamil, > >I've never used barcodes. But I do remember some discussion on barcodes in the Access-D. Perhaps someone there would have some thoughts. > >Good Luck! >Dan > >-----Original Message----- >From: dba-VS [mailto:dba-vs-bounces at databaseadvisors.com] On Behalf Of Salakhetdinov Shamil via dba-VS >Sent: October 26, 2017 00:46 >To: Development in Visual Studio >Cc: Salakhetdinov Shamil >Subject: [dba-VS] Printing 'Code 128 A' Barcode Labels > > >Hi All -- > >I have to print 'Code 128A' barcode labels in one of my customers C# applications' reports. Do you know any third-party tools lighter than LEADTools ( https://www.leadtools.com/sdk/barcode-pro ) to solve my task? > >FYI: I have googled and I have found several solutions but all of them look a bit ovewrpriced for a single task of just printing barcode labels. > >There seems to be also a free solution (https://www.codeproject.com/Articles/14409/GenCode-A-Code-Barcode-Generator) but I'm not sure it will be useful for my case where I'll have to print several labels in two columns in one A4 page. > > >Thank you. > >-- Shamil