Answer Questions
monkey1888 How to change the height of MainMenu?
I need a graphical mainmenu and am able to do it with OnDrawItem(). However, I also need the mainmenu to be higher so that the sub-menu will show at a lower position and not block my graphical mainmenu. Any experts can teach me how Another way is to do it with PictureBox + Context Menu. The problem is I fail to hide a Context Menu when mouse leaves the PictureBox because when the Context Menu is shown, I simply cannot detect the mouse coordination. I've checked this page already: http://www.windowsforms.net/FAQs/default.aspx PageID=3&CategoryID=3&SubcategoryID=71&tabindex=3 But mainMenu doesn't have this property http://msdn2.microsoft.com/en-us/library/system. ...Show All
xlordt input data to website
Ok right now I have to configure routers manually by inserting the exact same data into a router's configuration panel (website on router) then swap out the configured router with one that needs the exact same setup and redo this process over and over. I would like to write an application that fills in all the needed boxes,selects values from drop down menu's and fills in any other information and presses the save & restart button for me is this possible I initially though about trying to find the file on the router that its writing to thinking making its one config file maybe if thats the case I could just write to the file but im not entirely sure. yeh its one of those hit and miss things. hmm. Ca ...Show All
XNA Rockstar Casting Arrays?
Hi, I have a method which returns an object array: object[] sortArray(object[] input, int[] order); And I want to be able to cast the array that it returns, for example: string[] array = (string[])sortArray(input, order); While this compiles, at run time I get a casting error (InvalidCastException, Specified cast is not valid). How should I be casting the array, or can I cast it at all Thanks. You should probably iterate through the objects in the list and cast each item separately. In untested code: string[] stringArray; stringArray = new string[objectsArray.Count](); foreach (object obj in objectsArray) { stringArray[objectsArray.IndexOf(obj)] = obj.ToString(); } here Is a mu ...Show All
Chris Langsenkamp video\ audio, tool tip and saving file
Hi I have a couple of questions: 1) I have a pictureBox that and I want to add to it a tool tip. I looked at the properties tab and couldn't find the tool tip property. How can I add it 2) I have a form in which I capture a picture from a camera and then saves it to a file. After I saves the picture to a file, I change the image property of a PictureBox in my Form. When I try to save the file again, I get an External error exception. By the way the files is saved to the same place and as the same file name. Why do I get this exception and how can I handle it 3) For the capture code, I'm using API methods from avicap32.dll. what are the other alternitives to handle video \ audio in c# .net Is there a differnce between a ...Show All
Nickeay Local Security Policy
I am trying to locate any documentation on how to access Local Security Policy through code...and set them to desired values. Anyone have any ideas Or am I out of luck I already coded up a exe package that will set registry key values...However, I cannot find much information on setting Local Security Policy changes. Thanks Is there a possibility that you can set registry keys in the registry to certain values to attain desired results in the Local Security Settings ...Show All
Jesper Ekenberg getting file information (size on disk)
Hi Guys I am having problem using Pinvoke to call an API getcompressedfilesize to get the file size on disk. atm: [ DllImport ( "kernel32.dll" , SetLastError = true , EntryPoint = "GetCompressedFileSize" )] static extern Int32 GetCompressedFileSize( string lpFileName, out Int32 lpFileSizeHigh); called with: string name = i.FullName; Int32 size = ( Int32 )(( FileInfo )i).Length; Int32 realsize = GetCompressedFileSize(name, out size); --------------------------------------- This still gets the same size as .length, Please HELP. Cheers Onjay Are you sure they should differ yeah you are correct, if the compressed attribute for the folder wasnt check ...Show All
Tanzir Check if string contains valid year
How do I check if a string contains a valid year only... I've the classic way but it seems it works only with complete dates. Here's what I tried: string MyString = "2001"; DateTime MyDateTime = DateTime.Parse(MyString); Console.WriteLine(MyDateTime); This code snippet throws an exception ! Any help would be appreciated. Hi Raihan, Your code throws an exception because 2001 isn't a valid date. It may be a valid year (you and I both know it is), but just isn't a valid date. You could intialize a new datetime object and then use the AddYears method to add the number of years. The resulting date will be January 1st of year+1 (a new datetime intializes to 1/1/0001) string MyString = "2001" ; ...Show All
AdrianWoods 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 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 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 ...Show All
nbrege multithreading
I need to do multithreading. It is my fist attempt. It failed. This is the setup: There is a form with tabControl and a few pages. There is a progress bar on one of them. It is supposed to measure progress of file downloading. WIthout multhithreading it is dead while the files are downloaded and then in the end it jumps to 100%. This is what I did. Everything compiled but the progress never was activated even after the downloading was over. In other words my code actually made the things worse. In the main form I put in this code at the start of procedure that is handling the download: ThreadStart threadDelegate = new ThreadStart ( Work.DoWork ); Thread newThread = new Thread ( threadDelegate ); newThread.Start ( ); T ...Show All
breceivemail SELECT-INTO query problem
Hi I have a SELECT-INTO query which I wish to add some additional columns to the destination table. I can create the table and add the columns after it, but I wonder how is it possible to add that columns directly with the SELECT query. Thanks in advance, farshad Hi, Are you working with SQL Server You can add an additional column like this: SELECT *, null AS AdditionalColumn INTO DestinationTable FROM SourceTable Don't forget to add an alias to your new column, otherwise it will not work. Although this works, the additional column is not always with the correct datatype. When working in SQL Server, it might be easier to create a new table by letting SQL Server generate a script of the source table for ...Show All
babarzhr Exposing C# - Come & post your questions here!
Hi, I have gathered questions and did put them in a different post that I create (Many a C# Question) but I don't think anyone read them - seeing as that post doesn't have as many views now. So if anyone could answer the following questions, it would be much appreciated. Is it possible to generate a password after the application looks at the processor's id Eg. My processor id is 12345. A friend brings a program he made and installs it on my pc. The wizard first looks for the processor id (12345) then generates a code. How would that be done What are add-ons I saw them in the create project form but don't know how to use them or what they are. Can someone direct me please How can you make an application scan a ...Show All
guilhermecvm94558 Why doesn't IList have a BinarySearch method
IList<> does not have a BinarySearch method, but List<> does. Is there any reason for that The reason I found out about IList<> not having a BinarySearch method is because I initially wanted to do a binary search on a SortedList<> SortedList<>. Strangely enough, SortedList doesn't have a BinarySearch() function, so I looked in SortedList<>.Keys. That's an IList, which also does not have a BinarySearch() method. I looked up List<> to confirm, and it does have a BinarySearch() method. I've worked around this using (SortedList<>.Keys as List).BinarySearch(), and that compiles, but I have not tested it yet. So, there might be an easy work around, but I just can't think of a good reason why ...Show All
favio Warnings and classes
Hi! I'm new here and i've begun to learn C#. I have Microsoft Visual Studio 2005,and I think I found some bugs: 1. class Car { public int Year; } Why does this code create a warning (Field 'Car.Year' is never assigned to, and will always have its default value 0) Now this warning should be ONLY with unpublic fieds in structs and classes (written in MSDN - here's the link http://msdn2.microsoft.com/en-us/library/03b5270t(VS.80).aspx ) and Year is public! Is this a bug 2. When I compile code and having warnings, so when I hit the 'build' button again they just disappear! Strange... Thank you very much for the help! Yes it matte ...Show All
Michael Hansen predefined attributes
Are there any references on the ~200 predefined attributes in .Net/C# I can't find -any- information.. Can only get references on STAThread, Obsolete, Usage, Conditional.. Is there a way to create a customized attribute interacting with the IDE such as the ObsoleteAttribute one, which underline in blue the element... In fact I want to create my own MyHintAttribute attribute in order to display in the console during the compilation phase the hint specified... I will like documentation on all predefined attributes. Thats perfect, thank you! This page on MSDN lists the classes in the .NET Framework that derive from System.Attribute: http://msdn2.microsoft.com/en-us/library/2e39 ...Show All
LiquidAsh Drag-and-Drop HTML Link
Hey there, I'm trying to drag and drop an HTML link (an image link). When I drag and drop the link to my code, I got the target of the link. How can I get the source of the image instad of the target of the html link in C# For example, I have the following link in a web page: <a href=" http://msdn.microsoft.com "> <img src=" htt://www.aaaaaa.aaa/bbb.JPG " width="100" height="100" title="MSDN Link."/> </a> When I drag and drop the following link from the IE (I click on the image and drag it to my program), I got as a result http://msdn.microsoft.com .. What shall I do to get the " htt://www.aaaaaa.aaa/bbb.JPG " as a result instead of the ...Show All
