Answer Questions
SCRunner Hook desktop redrawing.
Is there any way (other than global hooking, which is disabled in .net) to catch events for desktop refreshes Has anyone ever tried this and managed a workaround to the global hook problem Or maybe someone could divert me to a C++ 2005 project that can do this for me.... Please ;) BTW I see ahmedilyas is the new king of the hill! Nice one ;) What are you trying to accomplish AndrewVos wrote: Any application. My program is being drawn using DC's over the actual desktop. It would be much more efficient if I didn't have to constantly redraw! Hmmm, Dont think that you accept event through C# that which Window is Redrawn at what time. Anyhow best of luck, If you get solution also sha ...Show All
Hossam Abdel Wahab Update issue vb.net2005 express - SQLServerExpress "Failed to convert parameter value from a String to a Int32."
Hi All, I an new to the .Net development (I used to work in VB6). I have a Problem updating a database and I can not figure out where the problem is situated !! On a form I've placed a datagridview linked to a sponsor table. I can see all the records and I can ADD new records to the database bu when I try to modify or dele a record I always get an error telling me I can not convert a String to an Int32 . This is strange as I have no fields in that table of the type Int32. I do not use the commandbuilder to generate the query and updateparameters but I code them myself. Here is my updatequery: UPDATE sponsor SET [id] = @id, [code] = @code, [name] = @name, [address_street] = @address_street, [address_street_2] = @address_street_2, [address_s ...Show All
Simon Rapier XmlSerialization with Interfaces
I'm trying to serialize a class that exposes a property as an interface. When I try to serialize the instance of the class the XmlSerializer throws an InvalidOperationException with the following message: {"Cannot serialize member SerializationTest.ParkingLot.MyCar of type SerializationTest.ICar because it is an interface."} This may seem like a silly question but is this true I've never ran into this before and I use interfaces pretty extensively in my designs. Can the .NET XmlSerializer not handle interfaces Thanks! Jeremy Thanks Mike, exactly what I needed to know! Jeremy A few things which might help. First, I would try and do a "reader.Read()" at the very beginning of the Deserializat ...Show All
Saqib Jahangir C# Com Interop problem - should be simple!
I have some trivial vb6 sample code that uses a com dll to interface to talk to some hardware but I can't seem to port it over to C# Interop successfully. I have tried many permutation of marshalling attributes but I get a "Attempted to read or write protected memory..." exception with types I believe will work and DataTypeError returned from the com interface function if I am deliberately incorrect with the types. The com interface declaration in OLE Viewer: long RpcCall(long iJobCode, VARIANT SendData, [in, out] VARIANT * RecvData); The sample in vb6: Dim n() as Byte Dim r() as Long n = StrConv("Time_s" & vbNullChar, vbFromUnicode) conn.RpcCall(10012, n, r) The intero ...Show All
efarook Determine if I can create Directories or files.
How do I find out if I have write access to a directory to create files and / or directories without actually writing/deleting anything. I started looking at ACL stuff but it's a bit daunting. I figured that somewhere in the bowels of .Net there is a 'IsWriteAccess()' call somewhere - just that I haven't been able to find it. My thanks to you both for answering. It appears the simple routine I wanted is not available. The purpose was a backup program. I did not want to alter the output directory till some future scheduled run-time as I also have an asynchronous monitor watching for timestamp changes. Paulustrious wrote: I did not want to alter the output directory ...Show All
Denis Pitcher Try refreshing the table adapter
It is my understanding that when using a TableAdapter and selecting the proper options, Insert, Delete and Update statements are generated. The Update statement should work just using the following: myTableAdapter.Update(changes); Where changes is the DataSet containing the modified data. This logic works great for one of the tables in the DB but not for another. Learning this new stuff is Confusing at best - Frustrating at worst. Help appreciated, Michael I have the same problem .. but the "Refresh the data table" is grey-out Edwin Thanks Claude... a good post. It resolved my problem. This error message appears to be some sort of catch-all. All ...Show All
bxw How to display an image of the resources in an assembly in the WebBrowser control?
Hello, does anybody know how to display an image of the embedded resources in the WebBrowser control In VisualStudio 6 and the IE-control this worked like this: Code: "<IMG src=\"res://ErrorDialog.dll/Error.jpg\">" I tried it this way in .NET with the WebBrowser-control: I Code: "<IMG src=\"Properties.Resources.ImageError\">" but it doesn't work... Is there a way to do this Best Regards B. Ritter Finally found the solution :-) Here is described how to add a win32Resource to an assembly: http://blogs.msdn.com/astebner/archive/2006/02/28/541036.aspx I added <Win32Resource>resIcons.res</Win32Re ...Show All
Alexnaldo Santos How to marshal correctly the following COM method?
Hey, I have the following exotic method in a COM interface (copied from IDL): HRESULT _stdcall GetDeviceFriendlyName( [in] LPWSTR pszPnPDeviceID, [in, out] unsigned short* pDeviceFriendlyName, [in, out] unsigned long* pcchDeviceFriendlyName); As you can see, the first parameter is straightforward, but the second and third use a typical C++/COM pattern. The method is first called with pDeviceFriendlyName == NULL to get the number of characters that need to be allocated in pcchDeviceFriendlyName. The caller can then allocate the required WCHAR* and pass it in (unsigned short* is really a WCHAR* in this case). tlbimp.exe crawls on this of course, so I decided to define this interface myself. My ques ...Show All
gabit7 Remoting+Serialize Bitmap Object
How to serailize Bitmap Object through remoting , So that I can read a *.bmp file into Bitmap object and retrun it back to the client through wire(Using .NET Remoting). Actually the Bitmap is a MBR and wouldn't marshal by value anyway. Ajai, Bitmap is MBR and so you cannot directly pass it as an argument. You need to convert it to a byte array and then reconstruct the bitmap on the other side. Maheshwar Jayaraman[MSFT] Convert it to a byte array You should be able to simply pass the object because it is serializable. Ya Its true but Its giving error while seralizing the Bitmapobject . Proxy exception is being raised by ...Show All
Polity4h can we generate sql server table from dataset
The purpose is to avoid typing all the field again in sql server when we have them in a dataset. 2/ can we do the same thing fro an xsd file Thanks. If you want to know the way I currently handle this in my apps is that I activate the VS option to automatically save change scripts in the solution's Database project. I then package these sql script files in a zip file and when the app lauches, I have a component that detects the current schema version from a metadata table and runs the sql commands in the appropriate zip files. It's pretty simple and works well. Charles 1) Usually we generate the dataset from the database by dragging tables from the server exp ...Show All
kcchesnut Comparing sql decimal to .net decimal
I pull decimals from a SQL 2000 database that have a scale of (14, 6). Let's say the value from SQL is 0, so it comes out 0.000000. I then do the following comparison: decimal x = 0; Convert.ToDecimal(column["column name"]) == x it comes back false. Why ! How can I compare a SQL decimal with a scale set to a local decimal That's what I do: private string columnToString( object column, Type type) { if (column == DBNull .Value) { return "(null)" ; } else if (type == typeof ( string )) { return column.ToString(); } else { if (type == typeof ( decimal )) { return Convert .ToDecimal(column).ToString( "N6" ...Show All
tanieboy Why must a type be marked as Serializable to be serializable???
I think when we want to serialize a type, we mean it. Why the Framework forces us to attribute it as Serializable In this way I have to add [Serializable] to the following simple class that contain ONLY simple privimite types, just to let it be serializable. class person { public string name; public uint age; } And more worse, if this class comes from a third party class library, I don't have a direct way to serialize its instances - I have to write custom converters or wrapper/mapper classes. Can someone wise enough to explain the reasons behind this design Thanks. Perfect. So, as a newbie to Enterprise Application Blocks, I need some help with [serializable]; I am getting a ...Show All
S. Register same type as service and client
Hi everyone, I have a remoting server app (.NET 2.0) which hosts a number of MarshalByRefObject Objects (all singletons). In some situations one of these objects may need to access members of one of the other remote objects. The problem is Remoting won't let me register a type as both service and client types (I get a RemotingException stating:"Attempt to redirect activation for type ..."). Am I trying to do something that is not allowed (or just plain stupid) or is there a way to achieve this. I hope this is a simple question and there is an easy answer. Regards, Mark. Hi Mark, If they are all hosted in the same app domain why do you need to use remoting. Seems like an over kill ...Show All
SachinPatole Error using tcpclient/tcplistener
I'm trying to run a sample tcpclient/ tcpListener program written in VB.NET on VS 2003 (.net framework 1.1). When I run this console program, I get 2 errors - 1) The requested address is not valid in its context - at System.Net.Sockets.Socket.Bind(EndPoint localEP) 2) System.InvalidOperationException : Not listening. Please call the Start() method - at System.Net.Sockets.TcpListener.AcceptTcpClient() The code as follows: TCPListener - Imports System.Net.Sockets Imports System.Text Class TCPSrv Shared Sub Main() Console.ReadLine() Const portNumber As Integer = 1526 Dim addrIP As System.Net.IPAddress = System.Net.IPAddress.Parse("170.186.144.132") Dim tcpListener As TcpL ...Show All
erbere Listing available network shares
Doing a vb.net project. I use directory.getlogicaldrives to get the local drives on a machine. Is there a way to similarly get all the available network shares (i.e. like my network places shows) I want to search for certain documents across a local network (typically a home network) and catalog them all. Thanks. I wish their was an eaiser example.... check out this page: http://www.codeproject.com/dotnet/WNetAPI.asp ...Show All
