|
|
Truth be told I wanted to put this in design and infrastructure but for some reason the page was blank. Anyways this is a good spot because it has some .net specific issues. I am starting to write a rather large program. Easily my biggest ever by a long shot. Now I am having an issue with how the interface should deal with requirements of the dll. I will give an example. The dll will make a submission to a website and the submission should have at least 1 image. So as I see it I have 2 options and could actually do both. Should the interface know this requirement and check if the user has added at least one image (therefore alerting the user and not making the submission) or should the dll throw an exception to which the interface will catch and then let the user know. Or should I do both? Or is there another way that I am not thinking of?
|
|
|
|
|
I will make sure if I want to make only website submission's DLL or make another DLLs using the same interface.
In the first case make sense to write the check at application level because you'll produce less code at DLL level.
But if you want to write not only website submission plug-in I will write the check at plug-in level and will have the exception handling at application level as you write.
Generally whatever you choose it should be clear and documented for plug-in programming purposes.
|
|
|
|
|
Hi all,
I've got an issue I've been digging on for a few days and just can't seem to find an answer. I have this textbox that's in a grid. The way this page is set up, when the user enters the page for the first time, the first row of the grid (including my troublesome textbox) is in edit mode. When I change the number from 0 to 10 in the textbox and tab out, I expect the TextChanged event to fire, but it doesn't. But if I click back into the textbox and change the number again and tab out, the TextChanged event does fire.
I thought maybe it was in my page load so I put a breakpoint at the bottom of the pageload method. At that point, the textbox.text = 10. I checked the viewstate of the textbox and the value is 0 and IsDirty = true.
I'm stumped what to check next. I also don't know what code to send since it looks like everything's set the way it should be but it just doesn't work the first time.
Any help you can give would be GREATLY appreciated.
Hypermommy
|
|
|
|
|
When I click on run I get this error (VS 2010 and VB.NET)
Error Could not copy "C:\Users\Danial\pay.mdf" to "bin\Debug\pay.mdf". Exceeded retry count of 10. Failed.
I have just changed the connection string from
Dim con = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Danial\ESI_PF_Payroll_V1\Pay.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
TO
Dim con As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Pay.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
So that I could not get errors while installing application on the client machine.
I got the error.
How could I get rid of that error?
my application is not starting.
|
|
|
|
|
It is probably because the properties of that file indicate that it should be copied to the bin\Debug directory when starting the application in Visual Studio. Change the properties so it does not always copy, or run your application from outside of Visual Studio.
Use the best guess
|
|
|
|
|
It is indicated that 'copy if newer' in the properties.
|
|
|
|
|
Then you should check that it can write into the destination folder successfully. It's impossible (from here) to discover why the copy is failing.
Use the best guess
|
|
|
|
|
Yes I know it's difficult from (there)to discover .but thank you for your help.
I have tried few times opening the application and now it works ...but will check why it happened ,because it might fall apart again.
|
|
|
|
|
It may well be that you have some connection left open somewhere that is preventing the copy from succeeding. It is probably best to run your tests outside of Visual ~Studio so that the copying of the database is not actually part of your test.
Use the best guess
|
|
|
|
|
This is just a stab in the dark, but possibly a typo? Maybe "Danial" should be "Daniel"?
|
|
|
|
|
|
Hi
I have written a code in C# to load functions in an unmanaged dll.
This is the code.
class Program
{
static unsafe void Main(string[] args)
{
int deviceNr;
char* Info;
int intMyReturnVal;
deviceNr = 0;
Info = null;
intMyReturnVal = sample_getinfo(deviceNr, Info);
}
[DllImport("opcard2lib.dll")]
private unsafe static extern int sample_getinfo(int deviceNr, char* Info);
}
and this is the API function description by dll supllier.
1. Sample_GetInfo
Prototype:
DLLReturnType
Sample_GetInfo (int deviceNr,
char* Info);
Parameters:
deviceNr is a number of found card in system
Info is handler for string with information about current card in system
Returns:
Returns 0 (zero) when success. Otherwise return an error code.
Description:
This function provide information about installed card in system. Information returned
in Info string looks like below:
„SN YY.SN rev. RRR", where:
YY – year of production
SN – serial number
RRR – firmware revision
The problem is that when I run this code I get the bellow error exception:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I have written this in VB.net to and get the same result.
I would appreciate your help.
|
|
|
|
|
The library function will store some data into the memory pointed to by Info so it needs to contain a valid address. You initialised it to null which is zero, an invalid address. You need something like:
char* Info;
Info = new char[128];
Use the best guess
|
|
|
|
|
thanks dear friend.
I will check it soon.
|
|
|
|
|
I notice that you also posted this question at Problem with P/Invoke[^] in Quick Answers. Please post in one forum only.
Use the best guess
|
|
|
|
|
it gives this exception
cannot implicitly convert from char[] to char*
|
|
|
|
|
Please show your code, what I provided compiles successfully, so i can only assume you have done something different.
Use the best guess
|
|
|
|
|
I just added this line to code as you mentioned.
Info = new char[255];
|
|
|
|
|
Please show the code block where the error occurs, indicate the line in error and the exact text of the error message.
Use the best guess
|
|
|
|
|
hi dear Richard MacCutchan
I think i have problem when the argument of the function is of pointer type.
I checked functions with no pointer and there was no problem.
As I searched the net I saw that something about Marshaling but I don't know how to implement it.
Is this the way or you suggest something else?
Thanks
|
|
|
|
|
Nooredin wrote: I think i have problem when the argument of the function is of pointer type. I checked functions with no pointer and there was no problem. That does not make sense, it just means that your function call does not match the function definition.
As to the remaining issue, if you have a problem with the code then you need to show us the code and any error messages you receive. If you need help in understanding how to use P/Invoke then I would suggest reading this white paper[^].
Use the best guess
|
|
|
|
|
hi dear Richard MacCutchan
you have helped me a lot with this. I appreciate it.
the most unbelievable problem with that dll was some functions did not included in the dll but described in manual and unfortunately i was focused on them
I have mostly done with this except introducing char array pointer to dll.
I wish I can do it soon.
By the way, thanks for your kind help.
|
|
|
|
|
Hi All,
My application is hosted in four servers. I wanted to create a tool that will be installed in any one of those servers. Purpose of this tool is to monitor App pool crash in each server and trigger a mail.
Could someone let me know how we can write this code in .Net?
Cheers
A.M.Jegan
|
|
|
|
|