|
hello,
i a new to C# and i am trying to figure it out! In C++ when adding a class to communicate with a db u add a class and select ODBC Consumer....
How do u add a class like above for C#? Can someone walk me through the steps in vs .net 2003?
thanks,
Lino
|
|
|
|
|
In C++, you were able to use a base class to write a class that was tied to a database. In C#, it does not work that way. A google of 'oledb C#' got me a lot of hits that looked useful, including this[^]
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
I am using a dataview to filter a dataset.
At first the datagrid is populated with 9 records. This is without a filter.
Then I check a checkbox to filter the dataset. This then returns 1 record in the datagrid.
Then I uncheck the checkbox and really I want the datagrid to be populated with the initial 9 records but it only populates with just the one as if the filter checkbox is checked. But the count on the dataset at this stage returns 9 and not 1.
if a dataset is filtered, then how do I get the initial number of records in the dataset (i.e. prior to filtering)?
Any thoughts please?
Thanks
|
|
|
|
|
-Populate Datagrid: Did you restore dataview's Property 'RowFilter' to the value before filtering when you uncheck the CheckBox.
I think you should implement something like this: DataView.RowFilter=CheckBox.Checked? [Your Filter Expression]:[The original RowFilter Expression(normally empty string)];
in the CheckChanged EventHandle;
-Number of Records: did you mean Dataset.Tables[index].Rows.Count .It's independent of on RowFilter property. This number won't change until you Remove a Record from table (Not even Delete) by using Rows.Remove(),Rows.RemoveAt()...functions
|
|
|
|
|
Hi,
Im a new guy in C# dev. I need to develop a component The requirement is..
I will be fetching a recordset from database which is of type dataset.(no problem for me here)
I will be taking the datatable out of the dataset which is having four coloumns..ie OrderID,OrderDate,ItemName,ItemID.
The requirement is to generate a XML file for each OrderID in the datatable.
One OrderID may be associated with Multiple ItemID and ItemName...
I need to filter out the table so the i take One OrderID and associated coloumns(orderdate,ItemID,ItemName) and send those values to other method cof generating the XML string.
Here im having some trouble , How to filter out and from the child table which is having One orderID and other values?..
Table:
OrderID OrderDate ItemName ItemID
1 date itemname1 3
2 date itemname2 4
4 date itemName3 4
1 date itemName2 5
....
I need to generate XML file which will contain information about ONE orderID, and the other details. How to filter and call the xmlgenerate method having only details about one OrderID and associated values.
Happy coding!!
kotteeswaran
|
|
|
|
|
I've tried googling and searching this site on stuff on VSTO in VS2005 and Office2003, but I've come up with very little and was hoping to find either a point in the right direction, or some help. I have an array of strings that is the name of a set of columns, and a table of data that is generated through a call to a SQL server. A listobject limits the functionality of what I want to do, so (at the moment) I'm just manually assigning all the data cell by cell.
Anywho, what I want to do is have the header of each column be a hyperlink, and (its not decided yet) either spawn a new sheet with some information(based on another query), or spawn a new window with the same query. What I need to do is find examples of Hyperlink.Add that lets me either attach the hyperlink to a method, or how to cause the hyperlink to open another sheet/window. At the moment, I'm just simply manually setting the column header text, which are not hyperlinks.
I looked at the MSDN pages as well, and there aren't any concrete examples of what I'm looking for, and in my tinkering I haven't found anything that works yet.
Anyways, a point in the right direction would be greatly appreciated.
-- modified at 16:38 Tuesday 13th December, 2005
|
|
|
|
|
Hi guys :
which are the differences between ServicedComponent(com+) and ClassLibrary(component)?
are they incompatible??????
thanks
-- modified at 15:50 Tuesday 13th December, 2005
|
|
|
|
|
Hi All! I want to write a program that can raise mouse click event( in other window or desktop), but i don't know how to raise that event.
Any Idea??
|
|
|
|
|
Can you rephrase the question please?
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Hi there,
You can use SendMessage API...
it should be something like SendMessage(iHandle, WM_LBUTTONDOWN, 0, lparm);
<< >>
|
|
|
|
|
You need to investigate SendMessage and PostMessage. Then, you need to understand the constants WM_LBUTTONDOWN and WM_LBUTTONUP. Then, read Test Run: Low-Level UI Test Automation and you will know everything that you need to accomplish what you want to do.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hi!
To send windows a mouse event, you can use the "mouse_event" API of the user32.dll. Decalre as following:
<br />
[DllImport("user32.dll")]<br />
private static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, int dwExtraInfo);<br />
Here are some constants needed, saved in an enumeration:
<br />
private enum MouseEventTFlags<br />
{<br />
LEFTDOWN = 0x00000002,<br />
LEFTUP = 0x00000004,<br />
MIDDLEDOWN = 0x00000020,<br />
MIDDLEUP = 0x00000040,<br />
MOVE = 0x00000001,<br />
ABSOLUTE = 0x00008000,<br />
RIGHTDOWN = 0x00000008,<br />
RIGHTUP = 0x00000010<br />
}<br />
Now, you can call it like this:
<br />
mouse_event((uint)MouseEventTFlags.LEFTDOWN, 0, 0, 0, 0);<br />
mouse_event((uint)MouseEventTFlags.LEFTUP , 0, 0, 0, 0);<br />
When you send the press-button-down-event, you need to send the press-button-up-event too!
Marcel Erz
|
|
|
|
|
Thanks for your great help, i can raise some event, i'll have to find out how to use it effectively.
|
|
|
|
|
Hi,
Is there any easy way to say that, on textboxHover , if the text inside the box isn't completely visible, to have a popup tool come up showing the complete contents of the box? I'm guessing I need to know if there's a way to determine the number of pixels that some generic text takes up. As an added bonus, is there a way to extract the pixel length from textbox.Size (to save some time looking values up)?
Thanks so much!!!
Mel
|
|
|
|
|
You can use the TextBox.CreateGraphics() method to get a Graphics object. Then, use Graphics.MeasureString() to get the size of the text in the textbox. Then, compare that to the width of the TextBox .
Also, you can use TextBox.Width to determine the number of pixels in the width TextBox .
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
|
No problem! Glad I could help. Happy coding!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
OK - I want to keep the question short & quick. Please help me.
Step 1: I write an unmanaged DLL in C++. Here is the exported function:
SAMPLEDLL_API void StringAsOUT_AllocatedInDll( char ** szParam )
{
*szParam = new char [ 128 ];
strcpy( *szParam, "Please free my memory after using me!" );
}
Step 2: I write a C# managed EXE to use this DLL
class Imports
{
[DllImport("SampleDLL.dll")]
public static extern void StringAsOUT_AllocatedInDll( ref int szParam );
...
}
...
Imports impObj = new Imports();
int iAddressOfANSIString = 0;
impObj.StringAsOUT_AllocatedInDll( ref iAddressOfANSIString );
string strOUTPUTFromUnmanagedDll = Marshal.PtrToStringAnsi( ( IntPtr ) iAddressOfANSIString );
Console.WriteLine( "Value of strOUTPUTFromUnmanagedDll = {0}", strOUTPUTFromUnmanagedDll );
...
Question: The code works. It does give console output "Value of strOUTPUTFromUnmanagedDll = Please free my memory after using me!"
But isn't there a memory leak? How do I free the memory allocated by new[] inside the unmanaged DLL? All the Marshal class helps artciles always refer to how to free an unmanaged memory block when it is allocated from .NET code. But here it is allocated by unamanaged code. If anybody can please help me with this, I will be grateful.
Thank you!
Koushik Biswas
|
|
|
|
|
Hi all,
I have problem when merging existing DataTable into new dataset.
DataSet ds = new DataSet();
while ( done )
{
// fill myCustomDataSet.MyTable with data
ds.Merge( myCustomDataSet.MyTable, bPreserveChanges,
MissingSchemaAction.Add );
ds.AcceptChanges(); // tried with and without this line
}
In the loop I am filling my datatable and then I need to add all
content to new dataset.
I tried all combinations for bPreserveChanges, MissingSchemaAction but
can not accumulate rows in new dataset. If bPreserveChanges = true I
have only rows which were added during first call to Merger. If
bPreserveChanges = false I have rows from the last call to Merge.
Tried also to have myCustomDataSet.MyTable with or without primary
key. No difference.
I would really appreciate any suggestions
Thank you , Roman
|
|
|
|
|
Have you tried ds.Tables.Add(myCustomDataSet.MyTable.Clone())?
|
|
|
|
|
Thank you for response, but this definetly won't work, it will throw exception during second call to Add()
|
|
|
|
|
Hello,
Is there a way of calling ButtonCancel_ClickEvent, when the user clicks the X?
Or the only way is to place a call within the dispose method?
Thank you.
|
|
|
|
|
You can do this by responding to the forms OnClosing event.
|
|
|
|
|
I have a function "Execute(object a, object b)". If I call it directly, like Execute(Type.Missing, Type.Missing), everything works fine.
However, if I try to use MethodInfo.Invoke() to call it with the same two Type.Missing in the parameter list, I will get an exception saying that
This function doesn’t have any default parameters.
Do I forget to do sth?
PS: I read about the ParamterModifier class on MSDN, it mentions an attribute called pdHasDefault. Is that the solution to my problem? How should I use it?
Thank you very much
Brandon
|
|
|
|
|