|
Hello,
I've coded my own NumericTextBox. But there's a little feature I want to add: If you try to enter a character in the TextBox, this very typical sound should be played. But I don't know how I can do this.
|
|
|
|
|
If you've done this correctly and your already filtering out the incorrect key presses, you could just P/Invoke Beep in the Win32 API.
[DllImport("kernel32.dll", SetLastError=true)]
static extern bool Beep(uint dwFreq, uint dwDuration);
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi every body!
My company wants to write a chat program. There will be about 300 people using this program. I see that we can use remote object technology to write this program. But I don’t know whether I will have to face with any problem when I deploy this program, what is advantage, disadvantage of the technology.
Could you give me some opinion?
Should I use remote object or socket technology?
Thanks a lot!!
xyz
|
|
|
|
|
It really doesn't matter which one you use. For a chat program, it's just a matter of preference, neither is harder than the other to implement, IMHO...
Why would your company want to write a chat program for internal use, when there are tons of them on the market that would probably cost less, off the shelf, if not free in some implementations, than paying you by the hour to write it?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am trying to pass an Int32 array from C# to C++ COM object but am getting E_UNEXPECTED error from SafeArrayAccessData(…) call.
From C# I pass 'ref object' where the object is my Int32 array, and my COM object receives it as a VARIANT*.
Thanks for any suggestions
|
|
|
|
|
Hi,
I am looking for a recommendion a good utility for creating typed collections in C#, preferably a plug in to VS.NET. Could you let me know if you know of any good utilities?
TIA
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
|
nice of you to share us the solution you found..
a small note :
in the .net framework 2.0 collections will be available as templates.So we'll have better performance since there will be no casting and boxing/unoxing.
|
|
|
|
|
hspc wrote:
nice of you to share us the solution you found
Your welcome. Actually, I'm still hoping for a recomendation because that one I mentioned is a little quirky. But the article itself is quite useful for a starter in to VS Add-ins.
hspc wrote:
in the .net framework 2.0 collections will be available as templates
Except that what everyone knows and loves as templates is called "generics" in .NET 2.0.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
sorry, but i meant how to deploy an application.exe . there are tow application: the first application deals with some Xml files, but this files are them selves generated by a second application, so can i use this last one (second application) to generate the xml files (already done) and deploy the Firstapplication.exe that use the generated xml files and so create a firstapplication Setup.exe without using the setup wizard.
|
|
|
|
|
Hi,
Can anybody tell me how to programmitically extracting a zip file in asp.net & c#.
Thanks in advance.
Vinod
|
|
|
|
|
|
Morning All,
A couple of questions for any remoting gurus out there!
1) How do I return an instance of a different type of object from a server object back to the client
eg: (Psuedo Code!)
ServerObject2 ServerObject1.GetAnotherObject()
{
return new ServerObject2;
}
2) How do I enable two way remoting so I can send an object created on the client back to the server
eg: (Psuedo Code!)
void ServerObject1.UseAClientObject(ClientObject oClientObject)
{
this.ClientObjects.Add(oClientObject);
}
Cheers - James!
James Simpson
Web Developer
imebgo@hotmail.com
P S - This is what part of the alphabet would look like if Q and R were eliminated Mitch Hedberg
|
|
|
|
|
i need to call a function of a C DLL. the function is declared as
_EXTERN int __stdcall MyFunction(HWND hWndParent, LPTSTR lpszRow1, LPTSTR lpszRow2, LPTSTR lpszRow3);
so i've defined in my c# code
[DllImport("library.dll", CharSet=CharSet.Auto)]
protected static extern Int32 MyFunction(int hWndParent, StringBuilder lpszRow1, StringBuilder lpszRow2, StringBuilder lpszRow3);
in the C/C++ code i have to pass 3 strings of 42 chars (8-bit each) and the function fills the tree with some names.
in c# i've created 3 StringBuilder variables and initialized to 42 of both length and max capacity.
When i call the function the strings are written but the problem is that each char of the StringBuilder is of 16-bit so 2 characters are in one.
Is there a way to extract each single char or to define a StringBuilder of 8-bit elements? I've tried to use string and LPTStr parameters for the function but the DLL doesnt seem to copy anything in my strings.
Gianmaria
|
|
|
|
|
i've resolved changing CharSet=CharSet.Auto to CharSet=CharSet.Ansi in the function definition
|
|
|
|
|
Hello and sweetest wishes for everybuddy,
As part of my project in one ASP.NET server application I have to check if some valid IP client node (wich contains an ASP.NET web application itself too) is currently connected to internet or not and decide based on this state.
One way I think about is to put a socket server on the client node and send a connection request for that to see if it will be successful or not.
I wana see other programmers' experienses and suggestions if there is some better way for that or some special pattern in the socket approach.
Please note I need acceptable speed to see check result.
Thank you so much,
- den to fly
---
"Art happens when you least expect it."
|
|
|
|
|
hai there,
i have a block of code that will generate indexoutofrange exception.
but on catch block i will use Exception (super).
in both cases exception will catch.This is one situation where i know the chance.
My question is what is the performace and resource usage variation if i use Exception Class insted of indexoutofrange on above situation.
Sreejith S S Nair
|
|
|
|
|
There is no difference because the exception chain won't be walked until an Exception actually happens. When the chain is walked, the exception that was thrown will be compared to the narrow exceptions first to see if there is a handler, if not, the more general exceptions will be checked locally first, then following the call chain, keep going until a handler is found or not.
If your trying to determine which Exception class to catch, either IndexOutOfRange or Exception, to see which one is faster, the answer should be neither. IndexOutOfRange MIGHT have a very slight speed advantage. You'll just have to test it to find out. How long does it take to catch 100,000 Exceptions compared to 100,000 IndexOutOfRange exceptions?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi every body!
I'm learning about remote object.
In a sample i'm learning there a statement
Type.GetType("SharedAssembly.SharedObj,SharedObj")
all time when this statemet is excuted, it return null
SharedAssembly: namespace.
SharedObj: a class in above namespace.
Could you tell me how can i fix it?
Thanks!
xyz
|
|
|
|
|
Type.GetType("SharedAssembly.SharedObj, SharedAssembly");
For remoting you'd use <a href="http://msdn.microsoft.com/library/?url=/library/en-us/cpref/html/frlrfSystemActivatorClassGetObjectTopic.asp?frame=true" target="_blank">Activator.GetObject</a> . See the example code in the MSDN overview of Client Activation.
Ian Mariano - Bliki | Blog
"We are all wave equations in the information matrix of the universe" - me
|
|
|
|
|
Hi,
I am a newbie in C# and SQL programming, and I have questions regarding autonumber for one of my table coloumn. Please kindly guide me.
I have this one table consisting of JobID, CustomerID, and Date.
On the coloumn JobID, I like to put autonumber there, since JobID coloumn is also my primary key for the table, so null is not allowed.
I first build the Data Adapter, by using design view, and make new stored procedure for that table.
I also changed the property on the column by setting the Identity to YES, Identity Seed to 1, and Identity Increment to 1.
I did run the SQL stored procedure, it gave me the autonumber on coloumn JobID, but when I tried to put the command in my windows form, it game me error: "An unhandled exception of type 'System.NullReferenceException' Occured"
These following are the codes that I put on my windows form.
<br />
jobDA.Fill(jobDS, "table_job");<br />
<br />
DataRow job = jobDS.Tables["table_job"].NewRow();<br />
job["CustomerID"] = cmb_cust.ValueMember;<br />
job["Date"] = date.Value;<br />
tandaterimaDS.Tables["table_job"].Rows.Add(job);<br />
jobDA.Update(jobDS, "table_job");<br />
and these are the store procedure that I have:
<br />
ALTER PROCEDURE programservice.insert_job<br />
(<br />
@JobID int output,<br />
@CustomerID char(20),<br />
@Date datetime<br />
)<br />
AS<br />
SET NOCOUNT OFF;<br />
INSERT INTO dbo.table_job(CustomerID, Date) VALUES (@CustomerID, @Date);<br />
SELECT JobID, CustomerID, Date FROM dbo.tabel_job WHERE (JobID = @JobID)<br />
SET @JobID = SCOPE_IDENTITY()<br />
Please kindly help me with this problem. I've been stuck here for several days.
Thank you very much in advance.
|
|
|
|
|
Swap the last two lines, like so:
ALTER PROCEDURE programservice.insert_job
(
@JobID int output,
@CustomerID char(20),
@Date datetime
)
AS
SET NOCOUNT OFF
INSERT INTO dbo.table_job(CustomerID, Date) VALUES (@CustomerID, @Date);
SET @JobID = SCOPE_IDENTITY()
SELECT JobID, CustomerID, Date FROM dbo.tabel_job WHERE (JobID = @JobID)
It's also probably a good idea to SET NOCOUNT ON , instead of setting it off. With NOCOUNT OFF , SQL Server will send a message back to the client like "1 Rows affected." Some versions of ADO/MDAC will receive this message and generate a null recordset from it. This may be causing your NullReferenceException . Most likely, though, I think the NullReferenceException is happening because your original proc returns a 0-row recordset.
Grim (aka Toby) MCDBA, MCSD, MCP+SB
|
|
|
|
|
You didn't say what line the exception happened on. Also, a more complete code sample would be needed. The sample you provided doesn't have a definition for tandaterimaDS . It looks like your getting a new blank row from jobDS , filling it, then trying to add that row to a different dataset, tandaterimaDS . This won't work. The you created must be added back to the dataset that created it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I've tried to set the nocount to on (SET NOCOUNT ON) and change the little mistake I have (JobDS), but it still come out in error.
When the error comes out, it highlight this line:
tandaterimaDS.Tables["table_job"].Rows.Add(job);
I am so confused with this problem, because when I run the stored procedure only, it has no problem or error.
|
|
|
|
|
I've already asked this question, but I'll do it again...
The stored procedure probably isn't the problem. Please post a more complete code sample so we can see what your doing.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|