|
Thanks for your reply Luc.
I've have changed the reference back to a val and know the error does not appear (could have sworn it was earlier!) Now I just get nothing back at all!
How would I pass a StringBuilder object to the API when it is asking for a string?
Many Thanks
The FoZ
|
|
|
|
|
1.
change the C# prototype, from "myFunc(..., string rs4, ...)" to "myFunc(...,StringBuilder rs4,...)".
2.
Make sure to create the SB beforehand and give it ample capacity, something like:
StringBuilder sb=new StringBuilder(1000);
myFunc(..., sb, ...);
string rs4=sb.ToString();
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thanks again Luc
One of the things I missed from the VB code is that rsBuffer should be 9 characters in length. Once I changed the to the string builder with a length of 9 I got the correct value returned.
1 function down, 9 to go.
Cheers
The FoZ
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
TheFoZ wrote: //Declarations
//Declare Sub QAInitialise Lib "QAPUIEK.DLL" (ByVal vi1 As Long)
[DllImport("qapuiek.dll")]
public static extern int QAInitialise(long vi1);
Change the long parameter declaration to an int .
In VBA and VB6 code, the type Long is a 32-bti signed integer. In C# and VB.NET, that's an int , Integer , or System.Int32 .
|
|
|
|
|
Right. I missed that one.
However, it did survive the long/int mistake, showing the one advantage of little-endianness.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Lucky, lucky, lucky...
OT: Am I the only one who thinks of this[^] when I see "little-endianness"??
|
|
|
|
|
Dave Kreskowiak wrote: Am I the only one who thinks...
AFAIK yes you are.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I have made a solution in VS2008 using c# and it's functionality is reading from COM port and monitor the results in some forms and save some of the data in an sql or access database,as well.Now I want make my app as a service to be run before anyone has logged in windows.I have read something about a software but I wanna know how can I do this using .net.
|
|
|
|
|
|
Hey!
I'm trying to remove the AutoIncrement from an MS Access database. I'm using ADOX. The table has two foreign relations, these relations are removed (which works fine), however when I try to remove the Autoincrement property from the column, i receive the following exception :
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
m_catDatabase.let_ActiveConnection(m_strConnectionString);
foreach (Key keyRelation in m_catDatabase.Tables["Kengetallen"].Keys)
{
if ((keyRelation.Type == KeyTypeEnum.adKeyForeign) && (keyRelation.RelatedTable == "ProductGroep"))
{
m_catDatabase.Tables["Kengetallen"].Keys.Delete(keyRelation.Name);
break;
}
}
foreach (Key keyRelation in m_catDatabase.Tables["Product"].Keys)
{
if ((keyRelation.Type == KeyTypeEnum.adKeyForeign) && (keyRelation.RelatedTable == "ProductGroep"))
{
m_catDatabase.Tables["Product"].Keys.Delete(keyRelation.Name);
break;
}
}
Column clmnProdGroepID = m_catDatabase.Tables["ProductGroep"].Columns["ProductGroep_ID"];
clmnProdGroepID.Properties["Autoincrement"].Value = false;
The last line of code throws the exception.
|
|
|
|
|
Frnds,
IN MDI application whn one form is open and than want to open another form. How to close/hide the previous form?
|
|
|
|
|
To Close a form...
this.Close();
To Hide a form... Can you guess what it is yet?...
this.Hide();
If this is not enough of an answer then you need to try explaining your situation better
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
OK, this i Know. Lemme explain :
when i run my application my default form opens which is going to contain the child form. Now on that form i have my menustrip which contains multiple forms links.
When i select any of them than that form opens on the default form(without closing the default form) and when i again open the next form than the previous is still in open state. So at this point all three forms are open one over other.
This where i need to close the previous form.
|
|
|
|
|
OK so you are basically saying that you only want one child form open at a time?
Well when you open a child form, you need to keep a reference to it somewhere, like in you main form you have a global variable like...
Form openForm;
... then when you open a new child form (by clicking one of the links) then you test to see if one is open already, close it if so, then open the new child form like so...
void ButtonClick(object sender, EventArgs e)
{
if(!(openForm == null || openForm.IsDisposed))
{
openForm.Close();
}
openForm = newChildForm();
openForm.Show();
}
Life goes very fast. Tomorrow, today is already yesterday.
modified on Thursday, May 21, 2009 5:54 AM
|
|
|
|
|
|
when we give the print from internet explorer,
any of the Printing events are not fired?
Why? This was the code I'm trying with
System.Drawing.Printing.PrintDocument Pd = webBrowser.Document as System.Drawing.Printing.PrintDocument;
Pd.Print();
Pd.BeginPrint += new System.Drawing.Printing.PrintEventHandler(Pd_BeginPrint);
Pd.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(Pd_PrintPage);
Pd.EndPrint += new System.Drawing.Printing.PrintEventHandler(Pd_EndPrint);
Here webBrowser gives the Internet Explorer reference?
How can I get these events get fired?
|
|
|
|
|
Printing is always done at client side and not at the server.
Have a look here[^].
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
those events have been attached to a specific instance of a PrintDocument and will only fire when that PrintDocument calls for those functions.
your code is calling the Print(); function of the PrintDocument but your events are not attached until afterwards.... Thou I suspect you wont be able to get it working if you did call Print(); after you attached the events, but we shall see about that
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
when I consider the browser document as PrintDocument,
when we give the page for Print through File->Print-> select the required printer ->OK
but also, none of the above events gets fired?
what may be the reason?
System.Drawing.Printing.PrintDocument Pd = new System.Drawing.Printing.PrintDocument();
Pd.BeginPrint +=new System.Drawing.Printing.PrintEventHandler(Pd_BeginPrint);
Pd.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(Pd_PrintPage);
Pd.EndPrint += new System.Drawing.Printing.PrintEventHandler(Pd_EndPrint);
This also doesn't make any event get fired?
|
|
|
|
|
|
I just told you your events have been assigned to a specific instance of a PrintDocument i.e. Pd
These events will only fire when you call Pd.Print(); and it must be called after the events are assigned...
System.Drawing.Printing.PrintDocument Pd = new System.Drawing.Printing.PrintDocument();
Pd.BeginPrint +=new System.Drawing.Printing.PrintEventHandler(Pd_BeginPrint);
Pd.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(Pd_PrintPage);
Pd.EndPrint += new System.Drawing.Printing.PrintEventHandler(Pd_EndPrint);
Pd.Print();
...the events will now fire, providing your print document is set up. However they wont fire when you click print inside internet explorer
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi Guys,
Can someone help me,i need help with Regex.I want to validate a date in this format MM/YYYY,thus 02/2009,
Regards
Mninawa
|
|
|
|
|
|
ooo! you're good!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|