|
I'll poke around to see what i can figure out. Do you have any past projects you might be able to e-mail me to give me an idea of what to do?
|
|
|
|
|
There's nothing you really need, just create a managed dll, and you've got a project that you can write in c++, but which can be called from C#. Then you just add methods to your managed class that expose the methods you want to call. You create an instance of the internal class within the managed one, and pass the methods on to that.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
VB to C# is automated via numerous VB to C# conversion utilities (but C++ to C# can't be automated).
If the program is small as you say, then the demo edition of our Instant C# VB to C# converter may be all you need.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB.NET to C# converter
Instant VB: C# to VB.NET converter
Instant C++: C# to C++ converter and VB to C++ converter
Instant J#: VB.NET to J# converter
Clear VB: Cleans up VB.NET code
|
|
|
|
|
Hi David. If you followed the link, he has a VB6 app he wants to convert.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Right - you need to get that into the framework as the first step.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB.NET to C# converter
Instant VB: C# to VB.NET converter
Instant C++: C# to C++ converter and VB to C++ converter
Instant J#: VB.NET to J# converter
Clear VB: Cleans up VB.NET code
|
|
|
|
|
I am using Execute Scalar for a COUNT on a query and on the C# side I get a count of 1. Using the same query on the SQL side I get 0 results and (1 row affected).
How does ExecuteScalar work, I always thought it grabs only the result of the count...
|
|
|
|
|
Kuira wrote: How does ExecuteScalar work, I always thought it grabs only the result of the count
ExecuteScalare creates a Data Reader, and gets the value of the first column of the first row. Then closes the data reader. If any other data is available it is ignored. If there is no data at all then it returns null, if the value of the first column of the first row is a null then System.DBNull.Value is returned.
The query sent to ExecuteScalar can be any SELECT query that you like, although obviously only queries that return one row with one column are best.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Yea I thought so but apparently, it didnt, till I restarted VS.NET, then it seems to work as normal, I have no idea why but anyway....
|
|
|
|
|
Well, in theory anyway, your query worked. What you got back in the ExecuteScalar method is a dataset with two result sets. The first being a 1 row, 1 column table that returned the number of rows affected, 1. The second set, which ExecuteScalar always ignores, contained a 1 row, 1 column table with the value 0 in it. This is the actuall restult of your query.
To fix this, make sure you include "SET NOCOUNT ON" in your SQL batch:
string mySqlStatement = @"SET NOCOUNT ON;SELECT COUNT(column) FROM table WHERE condition;SET NOCOUNT OFF";
If your executing a stored procedure to return the code, put the NOCOUNT statements in the procedure, not your code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 0:33 Thursday 5th January, 2006
|
|
|
|
|
Hi ! I found many snippets (samples) of code on the web but every one is for C# with ASP.NET or written in VB.NET. My application is not WEB based but a normal Windows Form with a dataGrid (windows application). Sometime I want to change the background and foreground color of a row depending of some condition (NOT the SELECTED row). I understand the idea of using the databinding event (which is supposed to be throw at each Rows.Add()) but I still have problem with my code. Maybe I don`t really know how to use event. The other idea is to modify the Paint function (I am not very confident with this).
Can somebody show me a sample !!!
Thank you very much !
Danny Gilbert
Montréal, Canada
|
|
|
|
|
Hai,
You can actually inherit from DataGridColumnStyle and override the paint method where you check the condition and set the backbrush color accordingly. Just make sure all of your column styles has this code so the each column in row has same color.
Hope this helps
Thanks,
VPMahank
Here is a sample
public class DataGridTextBoxColumnCustom : DataGridTextBoxColumn
{
///
/// Invalidates the display of this column, causing it to be repainted.
///
public void Repaint()
{
Invalidate();
}
protected SolidBrush _BackBrush = new SolidBrush(Color.White);
protected override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight)
{
Brush bkBr = backBrush;
try
{
// you condition check logic
if( your condition == true)
{ backBrush = new SolidBrush(some color);
}
else if ()
backBrush = new SolidBrush(some color);
else
backBrush = new SolidBrush(some color);
}
catch (Exception exc)
{
} // ignore
finally
{
base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight); }
}
|
|
|
|
|
Thank you ! Now I understand more things. I do something like your proposal for any control... overriding the paint method for any control.
Thanks again !
Danny Gilbert
Montréal, Canada
|
|
|
|
|
Using this example I can set a row to a specific color based on its content, but it doesn't work if I sort the datagrid or use a DataView.RowFilter. Does anyone know how to make it work?
To clarify, in the paint method I get the number of the row of the datatable, so if row #2 has a value that sets the background to red, row #2 in the datagrid becomes red. But if I use a RowFilter so that row #1 of the datatable isn't shown in the datagrid, it is still row #2 of the datagrid that is red even though the content has changed and the row that should be red now is row #2.
/Cesa
|
|
|
|
|
Can anyone tell me how I can download my mail in Outlook 2003 using code. All the accounts in Outlook are configured and all I wish to accomplish is that when a user clicks a button on my form, the Email Send/Receive process in outlook is invoked and it closes Outlook when the emails have been downloaded.
|
|
|
|
|
I haven't tried this myself, so I can't give you specific instructions, but you could try using the Outlook Express Mail Object (msoe.dll).
From the VS toolbox, you can right click, and select Add/Remove Items. Then click on the COM Components tab, and look for the Outlook Express Mail Object, and check the box. This will add the component to your toolbox.
From here, search the web for more information on this object, and perhaps play around with it for a while.
Have fun. Good luck.
Roy.
|
|
|
|
|
Does anyone know how to access custom file properties... the properties you see in the "custom" tab in Windows XP when you right click and show file properties?
Just need something to get me pointed in the right direction.
Thank you in advance.
Jerry Holmes
jholmes@verdigre.com
|
|
|
|
|
|
Hello!
I am trying to do some P/Invoke and the native library returns a structure. How must I declare this in C#?
Assume this (only as example):
I defined a structure
[StructLayout(LayoutKind.Sequential)]
public struct ColorWithUUID
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] uuid;
public UInt32 argb;
}
and the native function looks like:
COLORWITHUUID* GetColorWithUUID(DWORD dwIndex);
So the native function creates a COLORWITHUUID object and returns the pointer to it. How would the DllImport in C# for this function look like? How can I convert the pointer to the ColorWithUUID structure?
Many thanks in advance and best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
[DllImport("whatever.dll")]
IntPtr GetColorWithUUID(uint index);
IntPtr structPtr = GetColorWithUUID(index);
ColorWithUUID c = (ColorWithUUID)Marshal.PtrToStructure(structPtr, typeof(ColorWithUUID));
<pre>
-- modified at 14:32 Wednesday 4th January, 2006
|
|
|
|
|
Works like a dream, thank you very much!
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Hello coders,
I am using VS.NET, Application type is SmartDevice. In this form I placed the webBrowser control. I added one context menu with 3 MenuItems.
ContextMenu Implementation code is properly is taken, one more problem with webbrowser is not having
.ContextMenu Property. So I am taken
this.ConctextMenu = this.mycontextmenu1
my Problem is when running this application browser default contextMenu is displaying instead of my context menu.
any ideas??
regards
GV Ramana
-- modified at 13:25 Wednesday 4th January, 2006
|
|
|
|
|
Are you handling the HTMLDocumentEvents2_oncontextmenuEventHandler event?
If so, I believe you need to set eobj.returnValue to false and show your own custom menu.
"Patriotism is the first refuge of a patriot."
|
|
|
|
|
I am not yet get, My application type is SmartDevice Application in VS 2005.
HTMLDocumentEvents2_oncontextmenuEventHandler event is ?????
regards
GV Ramana
|
|
|
|
|
The webBrowser control has an api with includes a document class which allows you to connect to various event handlers. I have not used it in a SmartDevice application, so I don't know what the limitations might be.
This [^] should give you an idea of how it is organized.
"Patriotism is the first refuge of a patriot."
|
|
|
|
|
Hi
I am using server.transfer("webform2.aspx") to open page webform2.aspx and displaying some information on this page.
Is their any way I can open this new page in a seperate browser window ? I dont want to use javascript.
Thanks
|
|
|
|