Click here to Skip to main content
15,393,837 members

Comments by Foothill (Top 134 by date)

Foothill 23-Jan-18 14:03pm View
Good point. I see C# and GridView and the first thing that pops into mind is WPF. **facepalm**
Foothill 22-Jan-18 10:57am View
Sending email can be quite simple. Start with the System.Net.Mail namespace. There are lots of examples on how to send an email.
Foothill 22-Jan-18 10:52am View
How are you getting your values to the grid view? Are you manually setting each value or using XAML XPath binding. If so, how are your bindings defined. They should be written like:
<GridViewColumn Header="Units">
<TextBlock Text="{Binding Path=Units, Mode=OneWay}"/>

Foothill 30-Oct-17 11:01am View
You can create self-signed certificates for ISSExpress!? You learn something new every day. I assumed something as bare-bones as IISExpress wouldn't have that capability. Do you have a link to the steps?

While you did provide a viable work-around, the original question still remains unanswered and I am still curious if precompiler directives can be replaced in C#.
Foothill 14-Sep-17 10:41am View
I agree. The best approach would be to analyze the queries and indexes of the target table to maximize efficiencies at the database. If queries are taking a long time to find data, it could be using a poorly written query or the database is creating the necessary indexes to find the data on each query call. Good indexes are key to fast queries.
Foothill 1-Sep-17 11:48am View
With C#, application settings (you will find them in your project's properties) are saved to a file in your User\AppData\Local folder which is loaded when you run your program. Also, you could store your user name, password, or connection string there. You could also just save them to a text file in the same directory of the executable and load it with the System.IO.StreamReader class.
Foothill 7-Aug-17 16:29pm View
Yea, I am beginning to think that what I am trying to do just isn't possible with TCP/IP. I think it would be better to switch over to UDP so I could use the socket in a fire-and-forget way to broadcast to all the clients.
Foothill 7-Aug-17 11:31am View
I think that my problem is that the server is reconnecting to the same client to send a second message and that is causing this error. Is there any way around that or should I use a small pool of sockets to get around this?

I did manage to get it to work with a create->send->acknowledge->close pattern but if the server ends up with dozens of clients connected, it seems very inefficient to be creating a whole new socket just to send a bit of text to all the clients.
Foothill 4-Aug-17 11:27am View
Could you change UpdateSourceTrigger=PropertyChanged in the textbox to UpdateSourceTrigger=SelectionChanged and see what happens? I am assuming that you want to display additional info about an item the user selects in the ListView.
Foothill 20-Jul-17 14:44pm View
Would this work:
Foothill 29-Mar-17 16:56pm View
You could get close using the Windows Management Instrumentation classes to get close to that information but not without a good bit of real-time calculations that would most likely disrupt the process you want to monitor.
Foothill 29-Mar-17 16:33pm View
Yes I had come across that answer but I didn't see how that solution could apply. However, taking a third look did lead me to the solution which I will post up shortly.
Foothill 6-Mar-17 17:01pm View
Set AutoScroll to false, maybe?
Foothill 6-Mar-17 16:50pm View
Have you tried opening the files with Internet Explorer?
Foothill 16-Nov-16 17:51pm View
I believe this link might help
Foothill 16-Nov-16 17:34pm View
To add onto Michael's solution below, the proper use of TryParse in this scenario is to test if the user actually entered a number for the postal code. Int32.TryParse("123D", out parsedValue) will return false and parsedValue will be null while Int32.TryParse("1234", out parsedValue) will return true and parsedValue will be set to 1234.
Foothill 15-Nov-16 17:17pm View
That might have to do. I am still wondering if there is better syntactic sugars for testing interfaces for null before attempting to execute their methods.
Foothill 15-Nov-16 17:01pm View
I have used that method before in the past but it is inefficient to cast twice. In reality, most, but not all, objects will implement the IPrimaryRelatable interface.
Foothill 17-Oct-16 9:24am View
Does it give you any errors when the color change should take place or just does the background color just not change?
Foothill 5-Oct-16 17:24pm View
When you say popup window, do you mean a whole new browser window, or one of those psudo-popup boxes through JavaScript?
Foothill 5-Oct-16 17:11pm View
Have you thought about using an ObservableCollection as the ComboBox source?
It should update your ComboBox on every Add() call.
Foothill 5-Oct-16 10:53am View
I don't know of anything pre-built to clone a MySql database to SQL Server.
If you want attempt transactions in MySQL, give this a read:
It looks complicated but doable.
Foothill 5-Oct-16 10:30am View
I can try. What specific information are you looking for?
Foothill 5-Oct-16 10:03am View
Direct support from Microsoft. All other database support is either through generic ODBC calls or their own custom database library (e.g. Oracle.ManagedDataAccess to name one).
Foothill 4-Oct-16 9:50am View
That has to do with connection pooling. I have run into problems myself with performing certain SQL operations. Call SqlConnection.ClearAllPools() before the transaction and see if that fixes the error.
Foothill 3-Oct-16 16:55pm View
SqlDataReader implements IDisposable. Do you get the same error if you wrap the readers in a 'using' block?
Foothill 29-Sep-16 17:55pm View
Not really since I am off work in about 4 minutes but that is a lambda expression, or anonymous function, that can be inlined into code. I find them very usefull when dealing with event handlers. But, these two lines really are identical
public void OnTextboxOpen(sender object, EventArgs e) { //handle event }
(s,e) =? { // handle event }

The => is more like a function pointer in this context.
Foothill 29-Sep-16 17:26pm View
You could try replacing tb.Hold += OpenCM with tb.Hold += (s,e) => { cm.IsOpen = true; }; and move the open call to a lambda expression inside the BuildTB() function.
Foothill 29-Sep-16 16:51pm View
Can you set the PlacementTarget? Could be that it is being displayed off-screen.
Foothill 29-Sep-16 16:38pm View
If you're using Windows Phone 8.1, this might help
Foothill 27-Sep-16 12:22pm View
Then read this. It should tell you everything you need to know.
Foothill 27-Sep-16 12:00pm View
Okay, I just pulled that one from the internet. I confirmed that this works in one of my WPF apps.
txt.FlowDirection = FlowDirection.RightToLeft;
Foothill 27-Sep-16 11:43am View
Try setting the RightToLeft property of the textbox to txt.RightToLeft = RightToLeft.Yes
Foothill 27-Sep-16 9:17am View
You could just work through the characters adding spaces as you go. There are lots of ways to do this.

char[] numberText = Array.Reverse(value.ToCharArray()); // flip the characters so it will start with the LSD
StringBuilder sBuilder = new StringBuilder(); // use the StringBuilder class to build your number string one digit at a time
for (int i = 0; i < numberText.Length; ++i)
sBuilder.Append(numberText[i]); // append a digit
if (i % 3 = 0)
sBuilder.Append(' '); // if it's a thousands digit, add your space

// the result is backwards, so flip and return
return new String(Array.Reverse(sBuilder.ToString().ToCharArray()));
Foothill 27-Sep-16 9:06am View
Your WSDL data is nested inside the web response?
Foothill 26-Sep-16 17:17pm View
UserNamePasswordValidator is an abstract class. You will need to derive a class from it. See example here:
Foothill 14-Sep-16 16:49pm View
Is TextWrapping = "Wrap" not an option?
Foothill 8-Sep-16 9:35am View
You might have found an actual bug in the framework. You could try to use an older or newer version of .Net to compile and see if the error remains. Since you don't indicate what kind of database you're trying to connect to, you could always see if they provide a brand specific database API.
Foothill 7-Sep-16 14:26pm View
Does it still give you an error if you write it like this: GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[]())?
Foothill 1-Sep-16 8:59am View
Quick question, are you trying to respond to events coming from the printer?
Foothill 31-Aug-16 17:58pm View
Took a minute to find but your Status event is raised by the application layer. Are you registering a delegate for the event? e.g. OnStatusChanged += HandleStatusChange; where the the handler's signature is HandleStatusChange(object sender, StatusUpdateEventArgs e){ // do something }
Foothill 31-Aug-16 17:40pm View
Well, for starters, 0x00000000 is a reserved address in Windows, as it is the NULL address. Most C programmers initialize pointers to the NULL address so programs die in this way so it's clear they forgot to assign something important a value. Since you are getting this particular error, I would start by looking for any points that the code jumps from .Net Managed to Win32 native, like System.IO, and make sure that all the parameters to the call are correct.
Foothill 31-Aug-16 17:28pm View
Leaking memory in a .Net application is not that hard depending on what you are using. For instance, any class that implements the IDisposable interface is a potential point of memory leaks. The easiest way I have found to leak memory in .Net is to create objects that are based on operating system constructs, also known as Win32 HANDLES in C & C++, and not calling Dispose() when they are not needed anymore. The best thing you can do is Dispose of all IDisposable objects.
Foothill 31-Aug-16 17:17pm View
Can you specify which type of event you are trying to trigger on? WPF has two different types of events that can be loosely referred to Top Down (uses EventArgs) and Bottom Up (uses RoutedEventArgs). Top down events, like MouseDown, are raised from the view layer but bottom up events are raised from the Dispacher layer (Windows Message Pump), like PreviewMouseDown.
Foothill 29-Aug-16 16:39pm View
Is this error on the web server or when you browse the website with IISExpress in Visual Studio?
Foothill 5-Aug-16 13:33pm View
If you want, you could always try to build a front end application (MVC w/ or WPF) using SQL Server Express and the AdventureWorks sample database.
SQL Server Express:

This will give you experience with the new SQL Server, application development, and how data can used in a business environment.

Edit: both of those are free by the way
Foothill 5-Aug-16 13:23pm View
If you find an Oracle bulk insert, be sure to share it. If you don't, you could always multithread your insert process to make it happen a lot faster.
Foothill 4-Aug-16 17:11pm View
I don't know if it will help, but here's something similar form SO
Foothill 28-Jul-16 9:55am View
Got my vote of 5.
Foothill 28-Jul-16 9:48am View
Do you mean how can you have UI controls change the state of the worker thread? If so, that can be accomplished through the various techniques of thread synchronization.

Link to MSDN:

Thread synchronization can be a tricky thing to maintain since the OS determines when a thread is allowed to execute code and you can never guarantee that threads will execute in any particular order. I have found that it is easiest to use worker threads with fire-and-forget calls such as updating files and databases or fire-and-update-progress-UI-until-done approach using callback functions so that long running tasks work continue in the background but the UI stays responsive and is constantly informing the user that their request is still being processed, thus eliminating the 'why is your app locking up' questions.
Foothill 27-Jul-16 17:10pm View
Yea, that's true. Since the OP didn't have a response to Griff's answer, I figured that explanation was sufficient. I felt like adding in a more advanced technique for comparison.
Foothill 27-Jul-16 11:11am View
No problem. Glad I could help. It took me a few days to work it out the first time.
Foothill 27-Jul-16 10:18am View
Is this for a Windows OS?
Foothill 27-Jul-16 10:15am View
I didn't check this to make sure it works but you might give it a once-over.
Foothill 22-Jul-16 11:07am View
I can't provide an answer but I can at least guide you to where the answer is.
Foothill 20-Jul-16 17:43pm View
For this case, the HRESULT: 0x8007007E seems to be generated when the CLR attempts to load a .DLL that either does not exist or was was compiled using a different CPU architecture then what your application was compiled for. If you follow the stack trace, you might be able to find the source of the problem.
Foothill 20-Jul-16 17:27pm View
About the only way I can think of to emulate input in C++ would be to use the Windows Message Pump
with SendMessage
in a separate application. The real challenge is to figure out what inputs to send.

*edit: windows messages are very low level programming and not the easiest thing to use.
Foothill 28-Jun-16 17:46pm View
If you want to gather information about the server and it's a Windows server, I suggest learning about the Windows Management Instrumentation (WMI) is a decent example.
It's very powerful stuff.
Foothill 28-Jun-16 17:28pm View
I'm no expert with networking but I can add this. is port your app is listening on. For two way communication between computers, one usually acts as a server and the other a client. If you want two user PCs to talk, I would suggest setting up a server to act the intermediary between them.
Foothill 28-Jun-16 17:11pm View
In your code block the only place I can spot where a collection used is GridView1.DataKeys[e.RowIndex]. Check if the row index in the event data is in the data keys. I would suspect that it is not.
Foothill 23-Jun-16 17:56pm View
A real world example of uses for negative integer numbers are coordinate systems, 3D graphics processing, and matrix calculations. I myself have never found a reason to use a signed byte.
Foothill 13-May-16 13:35pm View
To understand the performance impact of database indexes, I would suggest that you read up on what indexes are and the basics of their function.
Foothill 13-May-16 10:07am View
You are getting this error on your Development machine when your web application is launched with IISExpress?
Foothill 12-May-16 11:49am View
I just had this happen to me on a new Windows Server 2012 R2 server (IIS 8.5). What I had to do to fix this is to open the Server Manager -> Manage -> Add Roles and Features -> Server Roles -> Web Server (IIS) -> Web Server -> Application Development

These features are necessary for MVC 5 apps:
.NET Extensibility 4.5
ISAPI Extensions
ISAPI Filters
Server Side Includes
Foothill 19-Apr-16 17:04pm View
If you are using Windows Authentication with Active Directory, you could give the System.DirectoryServices.AccountManangement namespace a try. You could have the users in AD security groups based on permissions then run UserPrincipal.IsMemberOf(GroupPrincipal) to authorize an action.
Foothill 1-Mar-16 17:09pm View
You start your search in the System.DirectoryServices namespace.
Foothill 22-Feb-16 13:50pm View
Not trying to get into specifics, I would assume that the system that you're envisioning has data (database) that must be acted on by users through an interface (client - web based or application) that can assure uniformity and consistency. To make such a system that can scale to demand, it should have:

1. High-Availability Database -
2. An interface -
Foothill 22-Feb-16 13:32pm View
Is it a client front-end with a database back-end?
Foothill 22-Feb-16 13:26pm View
Without giving away any particulars, what is the architecture currently?
Foothill 22-Feb-16 13:21pm View
In essence, a distributed system combines multiple different processes with a common communication protocol and architecture to achieve predefined goals. If that is not what you mean by distributed, try looking up load balancing and high-availability.
Foothill 22-Feb-16 13:13pm View
Try looking up Microservices.
Foothill 19-Feb-16 14:51pm View
If you do a straight copy and paste of the .exe, does the program still crash on launch? Is your program writing to the registry?
Foothill 17-Feb-16 16:24pm View
Are you getting this error when running in the debugger and do you get the same error when not using the debugger?
Foothill 5-Feb-16 14:06pm View
Try putting the call to open the popup outside the foreach.
Foothill 2-Feb-16 16:42pm View
I would suggest stepping through the foreach to see if FindControl(v) is returning a value and if so, check to see what v.Substring(0,3) returns. Asp.Net likes to make additions to control names when generating the html is sends to the browser rendering the pointless.
Foothill 11-Jan-16 15:44pm View
This did give me an idea. It was a simple solution to add an overloaded function to advance result sets without having to make major modifications. Thanks.
Foothill 11-Jan-16 15:24pm View
That would certainly work. However, I already have substantial data access code in place around my sql calls and adding the NextResult() call is not feasible without a lot of rework. Trouble is that I made a minor change to have the CreateTransactionLogEntry procedure return a value. I guess reverting that modification and moving that result to an output parameter would require less rework.
Foothill 8-Jan-16 15:49pm View
If you always perform a boundry check on any index accessor before you use it, you can preven this problem and many others as well. IIRC, the Heartbleed bug was caused by a function that didn't validate a parameter before using it to access an array.
Foothill 4-Dec-15 13:49pm View
You initialized the array but you never created objects for it.
Foothill 4-Dec-15 13:43pm View
Nothing to do with the question but as a word of advise, I wouldn't post the server name. By the looks of it, it's a server a at the Department of Homeland Security field office in California or the California Department of Human Services. A prime target for hackers if any.
Foothill 3-Dec-15 13:24pm View
That's why I asked for the review. Thank you, phil.o.
Foothill 3-Dec-15 10:56am View
That's the page I followed. I'm just trying to make sure that the Regex is done correctly or if I'm missing something.
Foothill 30-Nov-15 15:54pm View
I'll try to be brief.

To me, abstraction in OOP is taking something complicated and wrapping it up in a simple to understand public method. With this, the programmer doesn't need to care how the result is achieved and only needs to be concerned with the result that they get.

Encapsulation is like an extension to abstraction as you can have one or two public facing functions that call dozens of private functions which do all the work. Once again, the end user doesn't need to be concerned with the 'how' just the result.

Quick example pseudo code (C#):

public class AppSettings
public static AppSettings LoadSettingsFile(string fileName);
private static FileStream OpenConfigFile(string fileName);
private static bool IsXmlFile(FileStream configFile);
private static XmlReader LoadXml(FileStream configFile);
private static LoadWebSettings(XmlReader xml);
private static LoadThemeSettings(XmlReader xml);

Here, the user is only concerned with getting an AppSettings object from a config file or getting error when something goes wrong (abstraction). Knowing all the steps taken would only make the process more difficult to understand and are hidden from the user (encapsulation).
Foothill 30-Nov-15 13:58pm View
I always looked at this as a fancy way to describe Public vs. Private variables and methods.
Foothill 20-Nov-15 9:56am View
What is the text value of TextBoxTHUGDR?
Foothill 17-Nov-15 17:32pm View
I think one option would be a product like BitLocker. It's drive encryption software for Windows that requires the user to enter the key code prior to loading the OS. It also encrypts the drive so even if somebody stole your laptop, without the key code, the thing is a brick.
Foothill 4-Nov-15 10:45am View
Is this a Unity engine script?
Foothill 30-Oct-15 11:34am View
Can you post the constructor for the Configs class?
Foothill 30-Oct-15 11:29am View
My first guess is here

byte[] file = (from f in db.TBL_ADVERTISEMENT
where f.ID == id
select new AdvertisementDTO

I think that Linq is returning and array of AdvertisementDTO objects and not the image byte array.
Foothill 21-Oct-15 13:23pm View
com.CommandText = "SELECT MAX(DocumentCode) AS DocumentCode FROM DocumentsHeader WHERE (DocumentCode LIKE @DocumentCode)";
com.Parameters.Add("@DocumentCode", SqlDbType.NVarChar).Value = Passvalue.ToString().Trim() + "%";
Foothill 21-Oct-15 13:19pm View
Try putting the wildcard character in your parameter value.
Foothill 26-Jan-14 17:59pm View
Well, when databases start telling what kind of data it's returning to you every single time, run-time type checking would be unnecessary. I'm just trying to come up with something truly flexible when creating data structures from imported data. Compile time checking would be awesome but I don't want to have to rewrite code for every different kind of data that could possibly processed. Knowing what kind of data will be returned beforehand is the best option but it doesn't always end up that way.
Foothill 26-Jan-14 17:49pm View
That's okay. This is something I've been thinking about for months. Basically, how could I leverage the massive parallelism of modern GPUs to tackle an exponentially growing chunk of data that businesses collect. If I can figure it out, you might just see the company I work for end up on the cover of Forbes.
Foothill 26-Jan-14 17:38pm View
What if I want to use run-time type checking to dynamically create my data classes?
Foothill 26-Jan-14 17:27pm View
That makes sense. The idea that this is stemming from is this. Lets start out with say 65 million records. These records can be processed in any which way of 35+ different computations. Using asynchronous database access, there will never be a coherent or predictable order to how the data will arrive at the processing end. I was just thinking that by setting up those 35 different processes as unique threads in the GPU, the CPU's sole job is to bring data in, navigate it to the correct thread, grab the processed data, and then send it back out for storage. The actual processing would take 60-100 clock cycles while moving the data around only takes a few. With this approach, if a couple of record types exist in far more numbers then others, extra threads can be created to process more records faster. This gives for a greater level of flexibility on how the actual program is executed. What do you think?
Foothill 26-Jan-14 17:03pm View
Wow. It never occurred to me to use polymorphism to get past the compile time type checking.
Foothill 26-Jan-14 16:47pm View
So, in theory, it is possible to have an multi-core processor act as the traffic cop directing data to and from waiting threads running in a GPU. From the viewpoint of pure data computation, the large-scale architectures of modern x86 and x64 processors is like using an earth mover to dig a post hole. I am approaching this from the idea that the architecture of GPU's are already optimal for performing millions of simple calculations per second and are already designed to run in parallel. Is something like that even possible?
Foothill 26-Jan-14 16:35pm View
So this would be a limitation of the language?
Foothill 26-Jan-14 15:03pm View
This is a good start. Your answer suggests that you are very knowledgeable in this area. Say that each separate thread was performing very simple calculations. Is it feasible to use the simplified architecture of nVidia's CUDA cores to accomplish massively paralleled programming?
Foothill 15-Nov-13 12:48pm View
I'll do that. Thanks.
Foothill 15-Nov-13 12:30pm View
You could always use datediff to get the difference for each entry then sum them up.
Foothill 15-Nov-13 11:23am View
I working on a modular processing model and I am taking into account growth. My base models would have 20-40 threads but if I want it to handle much larger jobs, like processing 300+ million records in an hour, I'll be needing to push multiprocessing and parallelism to it's logical limits. Since I'm not an MIT or Cal-Tech grad, I have no idea where to find the information on how I can achieve my goals.
Foothill 31-Oct-13 17:46pm View
First question, do you have necessary permissions to update the database as your login?
Foothill 31-Oct-13 17:20pm View
I've had this problem when I was learning how to interface web pages and SQL databases as well. We had to set up a role in the database for read and execute. Then we had to give the AppPool that ran the page permissions to the role. It gets a little more complicated if the database is using schema's other than dbo.
Foothill 31-Oct-13 17:16pm View
What kind of database? If it is MS SQL Server, using System.Data.SqlClient makes it pretty easy.
Foothill 29-Oct-13 11:59am View
Since System.Collections.Generic.List and System.Web.Mvc.SelectList do not derive from the same base classes (with the exception of Object), you cannot do an explicit or implicit conversion on them. The easy way would be to make a one-to-one copy between lists.
Foothill 26-Aug-13 23:12pm View
Thanks. The fact that every word of code in C++ means so much and that there is so much you can and can't do makes it challenging. Thank you for the clarification.
Foothill 26-Aug-13 20:06pm View
Well first off, you can't have a cube with 6 or 5 pieces as that wouldn't be a cube. Only 4 pieces works ;)
Foothill 26-Aug-13 19:46pm View
IIRC, the return parameter is added automatically, so you're basically duplicating it.
Foothill 9-Aug-13 17:13pm View
Ah, good point. Thanks.
Foothill 29-Jul-13 17:39pm View
You can always use a Delegate method for a callback.
Foothill 29-Jul-13 17:32pm View
Here's how to query a process:

Imports System.ServiceProcess

public function GetProcessStatus(byval MachineName as string, byval ProcessName as string) as ServiceControllerStatus

Dim SvcCtl as ServiceController

SvcCtl.MachineName = MachineName
SvcCtl.ServiceName = ProcessName
Return SvcCtl.Status

End Function

All you need is the list of machines and the service you want to check.

For executables, call Process.GetProcessesByName(exeName). Returns true if that executable is running. Not sure on how to call this on a remote machine though, never tried yet.
Foothill 16-Jul-13 17:59pm View
Have you looked into adding a Silverlight plugin? It's designed to handle streaming JPEGS.
Foothill 8-Jul-13 17:34pm View
Do you mean directly from the database? Then you can't. Databases don't store the data like that. In order to play a video from a database, first you must download the binary data, turn it back into a video file, and then you can play with any standard media player.
Foothill 3-Jul-13 10:12am View
Try removing the "gm862". The select statement for the command object is already set. It could be confusing it. Just an idea.
Foothill 2-Jul-13 10:06am View
I guess you can make the form modal, preventing the user from leaving that form.
Foothill 2-Jul-13 9:54am View
What platform are you targeting? Could use a little more information on what you are trying to do.
Foothill 24-Apr-13 11:39am View
I've looked into this before (just for fun). It's a good bet to redirect this question to the SEC (Securities Exchange Commission) as they would most likely be able to direct you on how to connect to the securites electronic markets. If I remember correctly, there are fees and licensing involved to get that kind of access.
Foothill 24-Apr-13 11:33am View
I have to ask, what kind of data are you putting into the primary key? If it is an auto-incrementing identity, then the chances of exceeding the size of BigInt are remote. However, if the size of the table does get big enough to exceed BigInt, the easiest way around that is to create a new table and store more data there.
Foothill 22-Apr-13 11:49am View
Are you refering to MS Access?
Foothill 22-Apr-13 11:47am View
What fields are you targeting for the merger and what kind of operations are you wanting to perform on the fields (e.g. sum, count, etc,...).
Foothill 15-Mar-13 16:50pm View
Wait, I found it. I left in the "set r = cmd.execute" when the command is returning an integer. Dumb. I've trying to figure this out for an hour. I guess that putting the code in another form helped me spot it.
Foothill 15-Mar-13 16:46pm View
Sorry, a couple of commented out function calls made it in there.
Foothill 15-Mar-13 16:44pm View
This is the parent function. As I stated in the original question, the data is stored just as it should and the stored proc returns 0. However, Access is still throwing a error when in reality, I cannot see a reason for it to.

Public Function addNewForm_FromStateList_ByStateForm_ADO(stateList() As Long, sForm As stateForm) As Boolean '
On Error Resume Next
Dim r As Recordset
Dim cn As ADODB.Connection
Dim cmd As New ADODB.Command
Dim i As Integer, sz As Long

addNewForm_FromStateList_ByStateForm_ADO = False

'Check for an empty state list (zero length array)
If isLongArrayNull_rSz(stateList, sz) = True Then Exit Function

'Verify the state form for required fields
If Not checkStateForm(sForm) Then Exit Function

'Establish and Verify the connection
Set cn = dbConnect
If connOpen(cn) = False Then Exit Function

'Prepare the command object
'If prepCmdObject_InsertStateForm(cn, cmd) = False Then Exit Function
If prepCmdObject_InsertStateForm2(cn, cmd) = False Then Exit Function

'Set parameter data
'If setCmdObjectParams_InsertStateForm(cmd, sForm) = False Then Exit Function
If setCmdObjectValues_FromStateFromType(cmd, sForm) = False Then Exit Function

'Got this far, time to push to server
For i = 0 To sz
cmd.Parameters("@State_ID").Value = stateList(i)
Set r = cmd.Execute

'Cleanup and exit
If Err.Number = 0 Then
addNewForm_FromStateList_ByStateForm_ADO = True
Debug.Print cmd.Parameters("@RETURN_VALUE").Value
End If

Set cmd = Nothing
Call CloseConn(cn)

End Function
Foothill 15-Mar-13 16:36pm View
Since I used cmd.parameters.refresh, ADO grabs the parameters from the proceedure itself. I then populate those parameters in another function.
Foothill 15-Mar-13 16:34pm View
You could code a function to automatically reposition the controls and the background. It would take a bit of math and some trial and error to get it just right.
Just play around with the 'Top' and 'Left' properties of the controls.
Foothill 15-Mar-13 16:13pm View
There is no relation between autonumber and the record count. Autonumber will always increment 1 from the last entered record.
Foothill 24-Sep-11 20:27pm View
Just for clarification, what benifit does making the parameter 'char *' a const provide.
Foothill 24-Sep-11 20:23pm View
I ran into a little snag with your suggestion before I changed most of them to void. Whenever I had cString& return type and returned 'this', the program called the destructor and destroyed the cString object at the completion of the fuction, thereby deleting the string. I'll go back and take another look.
Foothill 24-Sep-11 20:21pm View
Thank you for the input. This is a lot of information to assimilate, but you bring up valid points. Checking to make sure that there was enough memory has never crossed my mind (never made a program that big plus my comp has plenty), but it is duely noted. This has truely been a very good educational experience, plus, it's probably the best question I've asked on this site.
Foothill 24-Sep-11 17:02pm View
Thank you for the insights. I accomplished my goal of creating a string class that mimics what I've seen in other programming languages such as VB and Java. All I need to do is code a matching wide string class and add some functionallity to seemlessly exchange data between the two. This should provide a solid benifit as I expand my Windows programming skills. It's those pesky memory leaks that I'm most concerned with. There is a myriad of apps in circulation that still contain them after going to market, some of them leak memory like a seive.
Foothill 24-Sep-11 12:48pm View
I do understand that I might be re-inventing the wheel here, but I have this attitude about programming; why stand on the shoulders of giants when you can walk in their footsteps? These days, a majority of code is black boxed and neatly packaged. Figuring out how they did it is half the fun.
Foothill 24-Sep-11 12:14pm View
This is for educational purposes. The more I learn, the better programmer I will be once I finish college.
Foothill 23-Sep-11 16:06pm View
That worked. You learn something new about syntax every day.
Thank you.