|
Hi All
How can I use HRESULT in C# application in order to check the return value from COM method?
Thanks
|
|
|
|
|
|
Thanks a lot
|
|
|
|
|
And of course HRESULT is a simple int in the C# world.
|
|
|
|
|
Hi
I am just starting programing in C# and I couldn't figure out how to do this.
I have a function which returns a single dimensional array. Now I have to call this function 10 times and put this into a double dimensional array.
i did this:
/***********************************************************/
int[,] output = new int[10,100];
for(int i=0; i<10; i++)
output[i] = func(); --- func returns int[100]
/***********************************************************/
But it is giving error that output[i] should have two arguments.
Any help would be greatly appreciated
bart
|
|
|
|
|
You'll need to do something like this...
int[,] output = new int[10, 100];
for (int i = 0; i < 10; i++)
output[i,0] = func();
|
|
|
|
|
output is not a 2 dimensional array. its a 1-dimen. array which happens to be maintaining another 1-dim array.
/***********************************************************/
int[,] output = new int[10];
for(int i=0; i<10; i++)
output[i] = func(); --- func returns int[100]
/***********************************************************/
|
|
|
|
|
What is the proper way to scroll and RTF box when text is entered from network communication?
The app looks something like that following
+------------+
| RTF Object |
| output |
+------------+
| Input |
+____________+
My method has been something like
rtfObject.focus();
rtfObject.ScrollToCaret();
input.focus();
The problem with this is that the input.focus() will select all of the text if you happen to hit the space bar at the same time that it focuses the object. I would rather be able to just get the vertical scrollbar object and set it to max, but I have no idea how to do this.
Thanks,
Steven
|
|
|
|
|
I've been using Managed Directx9 for some time now, and have never resolved one of the first problems I had, and now it's becoming more and more important to see if there is a solution.
It's about dynamic vertex buffering - locking and unlocking, where none of the given solutions provide performance of the unmanaged directx - or I could not find a way.
Locking vertex buffer using two versions of the Lock method that return array is incredibly slow due to the allocation of the new managed array each time lock is called. Somewhat faster is locking with the GraphicsStream - but then setting of the stream is slow.
The fastest way (managed DX samples usually use it) is VertexBuffer.SetData method, however more than a half of it's time is used to execute DXHelp CopyObjectDataToPointer, and I haven't got a slightest clue what the rest of the SetData code looks like.
In my case render method spends 67% time in using SetData and the rest in drawing! And it should be like 10-15% in setting the data, and rest in drawing, like in C++ versions of the similar code.
And there is no unsafe version of the method! Why? I would like to generate my data 'unsafely' and just copy it to the buffer.
This way I generate it, then SetData copies it to unsafe ptr, lock the buffer, copy unsafe data to the buffer, an ulock the buffer, making an excess copy in the process and who knows what else.
It is obvious that in some cases there is more than double performance penality because of this.
Or I am blind to see another way, or somewhere completely wrong?
I'm speaking of the situations like drawing a text or such, where dynamic vertex/index is necessary.
And ofcourse, I have used .Default memory managment and .Discardable lock.
One more thing: DirectX managed demos and tutorials have the same problem and are (sometimes much) slower then their unmanaged counterparts when using dynamic vertex buffering.
I haven't tested DrawUserPrimitives but it's slower and it wouldn't solve my problem - i don't generate vertex buffer every but every 3-9th frame.
Can anyone help?
|
|
|
|
|
Have you asked here:
http://discuss.microsoft.com/archives/DIRECTXDEV.html
|
|
|
|
|
Hi,
I'm trying to open MS Access using OleDbConnection in a windows application but form will just frozen and not continue to the OleDbCommand? anybody knows why please?
Many Thanks,
Jassim Rahma
Jassim Rahma
|
|
|
|
|
Sounds like there is a problem connecting to the datasource. I'd say start by checking your connection string.
The word abbreviation is awfully long for what it means.
|
|
|
|
|
but Chris I'm using the same connection string for all my applications and never had a problem plus this application is working perfect on my laptop.
Jassim Rahma
|
|
|
|
|
I'm using the same code in all my other applications and the strange thing that the same application which is giving an error is working on my laptop with no problems:
strSQL = "SELECT * FROM account WHERE department = 'CRM' AND account_pin = '234567'";
// open database;
strConnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\temp\\Apps\\CRM Queries\\accounts.mdb;Jet OLEDB:Database Password=mem";
OleDbConnection dbConnection = new OleDbConnection(strConnection);
dbConnection.Open();
OleDbDataReader dbReader;
OleDbCommand dbCommand = new OleDbCommand(strSQL, dbConnection);
dbReader = dbCommand.ExecuteReader();
try
{
update_log("validating department and PIN");
while (dbReader.Read())
{
account_department_name = dbReader["department"].ToString();
account_department_pin = dbReader["account_pin"].ToString();
}
dbReader.Close();
}
catch(Exception exp)
{
MessageBox.Show(exp.Message, "Error");
}
finally
{
dbConnection.Close();
}
Many Thanks,
Jassim Rahma
Jassim Rahma
|
|
|
|
|
Not having much luck creating messages and changing the sent date/time for archiving imported messages from Notes to Exchange.
I'm not having much luck getting hints on how to do this from any boards or newsgroups either.
Does anyone here at CP have any experience doing this in C# or with any other language for that matter?
Thanks bunches.
|
|
|
|
|
Hello,
How does a service control manager (or operating system) know that a windows service did not start successfully? Should I throw an exception in the overriden OnStart function? Or is there some other way? Thank you in advance!
Rado
|
|
|
|
|
Hi!
Do you remember "continuous form" in form view in MS Access form designer? I need something like that in C# - one data source supplies multiple data forms (or custom controls dynamically placed on the form). How can I make it?
thanks
Hubert
|
|
|
|
|
I'm not quite sure what you mean since I havent been forced to use Access for a long time. But, a DataSet should be usable for multiple data views.
The word abbreviation is awfully long for what it means.
|
|
|
|
|
I have meant the component which is multiplicated as many times on the form/panel as the number of records in database is, and all of these components displays data from just one datasource.
In special cases this may look similar to the DataGrid bounded to data table in dataset - each row of data from the table is represented as single row of controls (TextBoxes typically) in DG. I have much more complicated data to work/visualize (about 50 data columns represented as buttons, combo boxes, text fields) so DG fails ;-(
I hope this made my question more clear
thanks again
h.
|
|
|
|
|
Off hand, I'd say you have two options.
First, you can add customized columns to a datagrid on the fly as you read the data from the dataset. Or second, you can enumerate the dataset and add the controls to your form on the fly.
A nice sample on this site that does the second option and can be found here [^]
For the first option, take a look here [^], while it may not be exactly what you need, the code does show how to add custom column types to a datagrid.
Best of luck.
The word abbreviation is awfully long for what it means.
|
|
|
|
|
hm, well, both of the above articles/codes are pretty good (and useful for other parts of my project) but it is still not what I've meant.
But... in the meantime, i have made something which realizes my functionality - it is pretty simple now, but tomorrow I'm going to apply it to my project and test.
And maybe I'll write a little article about writing my own DataPanel...
Thanks very much for help and (again) for interesting links above
H.
|
|
|
|
|
In the Windows App world, is there a C# property that will tell me if my application is the currently active app; the application that currently has focus? I've experimented with checking the TopMost property, but that seems to be more for when I want my app to always be on top; even if it isn't active. Sorry if this is a stupid question...I'm still a C# novice.
Ron Ward
|
|
|
|
|
|
Try the following out. Why is the emailsettings element tree read <b><i>BEFORE</i></b> the othersettings element (its parent)! Am I blind?
while( settings.Read() )
{
string section = settings.Name;
switch( section.ToLower() )
{
case "pollagentsettings":
break;
case "profileragentsettings":
break;
case "othersettings":
break;
}
}
/* Use this as your settings.xml document - it is the output from the XmlTextWriter
<?xml version="1.0" encoding="utf-8" standalone="yes"?><Settings><PollAgentSettings><ExecOptions type="SP" procedure="asdfasdf" interval="10"><TSQL /></ExecOptions><Servers><Server name="qwer" enabled="True" /></Servers></PollAgentSettings> <OtherSettings><EmailSettings from="qwer" host="asdf" subject="zxcv" /></OtherSettings></Settings>*/
|
|
|
|
|
Holy crapper!
If you put a space between the opening OtherSettings element and the opening EmailSettings element, it works fine. Can anyone think of a real good reason that is a bug?
Modified: Sorry make that just before the opening OtherSettings element.
|
|
|
|