Answer Questions
Ritesh Tijoriwala Evaluating a string to call a method
I'm new to C# and for better or worse i'm trying to do things the same as in the language i'm used to (OMNIS). In the past i could do this: String s1 = "printName('John Doe')"; Test.[s1]; And the square brackets would be evaluated and John Doe would be passed to the printName method in the Test class. I have a list of methods and parameters formated as strings from an external data source. Since my data source is defining the flow of the application the calls can change. So a nice for loop with a simple string evaluation would be wonderful to have instead of a huge switch statement that evaluates the string. As already suggested, use one of the string functions (or regular expres ...Show All
Quimbo Sending struct in C# to server written in C++
Hi, everybody. I have written a C++ server for receiving data of the type, struct node , using TCP. struct node{ int id; int data[256]; }; Now I want to write a client-side code that sends a node structures to this server. However, this client program has to be written in C#. Is the memory arrangement of struct in C# and C++ the same Could I declare the same struct in the client C# program and using MemoryStream and IFormatter to serialize the struct and send to the C++ server Thanks. push. ...Show All
BonnieB An example of a Messenger toast is the message that appears on a user's desktop when one of the user's contacts signs in.
An example of a Messenger toast is the message that appears on a user's desktop when one of the user's contacts signs in. Another example of Messenger toasts is the messages displayed when a user receives an alert from the .NET Alerts service. The following are examples of typical toasts: Could you please tell me how to catch the screens above If i clcik the "chage" in the screen and how to respond this event. Thanks in advance. Thanks, i will go ahead there for the info. I belive that i will find the answer there. hi, jacob. do you mean how to detect a toast pops up ...Show All
Gravy Creating instances of Filesystemwatcher at runtime.
Im working on a project where I need to let the users specify what directories to watch for incoming files. They can multiple directories to watch for multiple kinds of files, and then once a file is created / copied / moved into that folder the program does some parsing on them. For this i decided to create a class to launch a filesystemwatcher. However it seems that the FSWatcher must be created in a place where it does not go out of scope (such as the the basic form class). Here's my class class fileWatcher { private FileSystemWatcher watcher; //filters and settings for the fileSystemWatcher private NotifyFilters nf = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.Directory ...Show All
Vladimir Chtepa Checking for registry value
How will I do a code that will check if a certain registry value is currently in the registry, if not create it. I did somethign like this but I get an error: if (Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run").GetValue("CA", "C:\\windows\\consoleapplication2.exe"); == false) { Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true).SetValue("CA", "C:\\windows\\consoleapplication2.exe"); } take a look here on how to get a registry value: http://msdn2.microsoft.com/en-us/library/microsoft.win32.registrykey.aspx the above link also shows how to delete a reg sub key. Provide GetValue an object to return if the key i ...Show All
Ian Sullivan COM Class Factory not found
I couldn't find any better forum to post this in, so here goes. I've installed some software that was supposed to include an OLE automation DLL. I found a file called lmwole.tlb and ran tlbimp.exe on it. It gave me the DLL file I needed and I referenced this in my .NET app, but when I try to create some of those objects I get the error Retrieving the COM class factory for component with CLSID {FE32602E-78DB-4315-886A-3D1765EED909} failed due to the following error: 80040154. , which I assume means that no DLL got registered with that guid. My question is, I have a whole mess of DLL files that came with the software, and maybe one of them is my OLE Automation COM server. Is there any way to find out, and if so, can I just run regsrvr32 on ...Show All
donkaiser Applying Property Attributes decorating a class to its member properties
I am using attributes to supply range values for properties of an object being displayed in a propertyGrid. This works great when I am dealing with primitive types like int and float. However I have more complex data types that I want to decorate with a range attribute and have the attribute applied to member items of the object that was decorated. It should be noted that I have created custom type and property descriptors so that I have control over those description passed to the property grid. This allows me to control how the property grid displays properties dynamically. To apply the range constraints to the property I have overridden the SetValue Method in the property descriptor. The problem is when you are changing the value t ...Show All
Troy Lundin Event not firing...
I wasn't sure where to go with this... I wrote a file parsing program awhile ago and has been working wonderfully. I recently added some events such as drag-and-drop stuff, pretty simple and basic, and on my machine it works fine. We have other machines here at work with the same version of .NET and the same version of Visual Studio. The problem is, my Boss' machine (Of course it HAD to be his) does not allow these events to fire. At one point he got one to work but now it doesn't. We tried repairing the framework, un-installing and re-installing the framework, still nothing. It doesn't work within his VS or outside of it, but the rest of the program works fine. Now I don't know what would be causing this since it works everywhere e ...Show All
Ali Jannatpour Dataset problem
Now,everyone,here is the deal: I have a sqldataapdater1,sqlcommand1,sqlconnection1,dataview,datagrid1: here is the detail:(i want to see sql result in the datagrid1) sqldataadapter1.selectcommand=sqlcommand1; this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "PART", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("id", "id"), new System.Data.Common.DataColumnMapping("desciption", "description"), new System.Data.Common.DataColumnMapping("product ...Show All
hadjici2 translation of a little script from VB to C sharp pls
I want the script bellow in C# pls: "<SCRIPT LANGUAGE=""JScript"">" & vbCrLf & " function fnAdd(){" & vbCrLf & "document.body.insertAdjacentHTML('BeforeEnd','<P>' +document.getElementById('oText') + '</P>');}" & vbCrLf & "</SCRIPT>" I especially have a problem converting both the quotation marks and the VbCrLf when they re in the same string Thanks a lot VBCrlf is a carriage return I believe which is Environment.NewLine \ is known as an escape character meaning that if you just do a " it will block of the entire line as a string since "" is an indication of a string/text to be included in there. if ...Show All
Jocker23 I want to fill a username and password text boxes and then click to login button
Hi every one; I want to access a web site by fill the username box and the password box also, and then click to login button . can i do that programabitly . please help me URGENT please.please.... My Mail : Rami.Khalyleh@hotmail.com Rami This can be done but not putting values in textbox and clicking the button but progrmatically with URLs and posting the values... Try to explore HttpWebRequest and HttpResponse classes... Best Regards, Rizwan it depends how you are accessing the site. If you are using a webbrowser control then yes you can do this, even invoking the button I believe. http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=876724&SiteID=1 ...Show All
Barak Cohen About properties
Can someone please explain to me in plain english what the following code is saying public string Result { get { if (_userAnswer == _correctAnswer) { return "Correct"; } else { return "Incorrect"; } } } thanks This is a property function. It gives the class a read-only property called Result that is a string datatype. When you access the Result property of the class for read access, it runs the "get" function part of the Result property. The "get" function then compares the values of the two variables. If they are equal, the function returns "Correct" as the value of the Result property. If they are different, it returns "Incorrect" in ...Show All
geliser131 SerialPinChange.Break
Hi, When we encounter a SerialPinChange.Break condition, it throws an exception, which we handle but which also causes our application to abort. Is there any way to reset the SerialPort object to a "non-break" state Using a statement like "port.BreakState = false" does not seem to be sufficient. Yes, we finally found the root cause of the problem. Our microcontroller software was sending a modem AT command to our server software, where the SerialPort object interpreted the AT command as a break signal. When we removed the AT command from the data stream the break signal disappeared. Hello, i have the same problem , do you find a solution Regards ...Show All
Blu_Ciccio access a variable or control
how do I access a variable or control in one form like (form1) from other form like (form2) and how can I do this in MDI application You can simply make public the variable, or the control you need to expose. For controls, you can do this from the designer changing their Modifier property. The same applies to MDI. For instance, Form1 has a variable you want to change from Form2 public class Form1 { ... public int MyVariable; } public class Form2 { ... private void Button1_Click (...) { Form1 frm = new Form1 (); frm.MyVariable = 10; } } I would not recommend to use variables though: a property would be better as it allows you to better control access, and it allows you ...Show All
Bruce Baker FreeAllUnusedJunk() ? any such method?
I've got a program that runs through a loop, and during this loop, consumes a lot of RAM. of course, .NET is smart, and auto-disposes.. so the RAM usage goes something like.. 40MB, 80MB, 115MB, 230MB, 307MB, then it drops back down to something small again. The thing is, when this loop is over with.. the process could be eating up 40MB RAM, or 300MB. Is there some kind of global method I can call that basically frees up ANYthing that's not in use So why wouldn't you recommend calling the gc.Collect() I want to use it in my application. its bad practice and should leave the GC to do its own thing without interferring with it otherwise sometimes you will have undesira ...Show All
