Answer Questions
Minherz How can I check out whether the system is connected to the internet?
How can I check out whether the system is connected to the internet thanks! This question has been asked a couple of times previously and I'd suggest taking a look at a couple of those threads: Detecting Internet Connection how to detect internet connection automatically There are more than one way to get connection state The First is to use P/invoke and calling WinAPI InternetGetConnectedState The Seconed .Net 2 have NetworkChange class it hase two events NetworkAvailabilityChanged and NetworkAddressChanged for an example of this method look at http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=118246&SiteID=1 The Third to use System management objects for an example of this meth ...Show All
PerErik Using Global.asax in Visual Studio 2005
I am trying to write code which I only want to run on a per session basis. For this I want to include some packages such as using System; - however when I add the using keyword as below it is not recognised. How do I get a seperate Global.asax and Global.asax.cs page as in VS2003 I added this file by right clicking on the project and selecting Add New Item. From the list I then selected "Global Application Class". I do not seem to be able to view the CodeBehind page as I can with standard .ascx pages. Please let me know if you can view the code-behind for Globalasax in VS2005. Cheers, bri5 <% @ Application Language ="C#" %> < script runat ="server" Language ...Show All
JiltedCitizen Annoying problem VS2005 keeps writing errors in designer file
As soon as I open up a certain user control in designer mode VS2005 keeps writing new SCS3DiaGUI. DarkColourButton (); instead of new DarkColourButton (); in the designer file which gives me compiling errors Error 6 The type name 'DarkColourButton' does not exist in the type 'SCS3DiagGUI.SCS3DiagGUI' C:\Proj\Bromma\SCS3Diagnostic\Software\Src\SCS3DiagGUI\SCS3DiagGUI\EventManager.Designer.cs 40 46 SCS3DiagGUI How can I get rid of this annoying behaviour DarkColourButton was in another project previously. I had a reference to that project. /Lars I renamed the namespace of the DarkColourButton. But my form SCS3DiagGUI contains user controls which I show one at a time. These user co ...Show All
Softwaremaker How to create a folder in WSS site(with httpWebRequest)
I just want to create a folder(say a document library) in WSS site, and I have codes below, they don't work yet, always raise an exception says: 404 not found. Can somebody be kind to help me out Thank you guys in advance. public static void CreateDir_WebRequest() //under working... { string actionUrl = "http://localhost/_vti_bin/owssvr.dll CS=109" ; string referUrl = "http://localhost/_layouts/1033/new.aspx " + "ListTemplate=101&ListBaseType=1" ; string boundary = "----------" + DateTime .Now.Ticks.ToString( "x" ); HttpWebRequest preRequest = ( HttpWebRequest ) HttpWebRequest .Create(referUrl); preRequest.UseDefaultCredentials = ...Show All
Jon Royales Incorporate Java compiler in C#?
Dear all, i am new to C# and would like to know if i can create a program using Visual C# and incorporate a java compiler to run and compile java source codes in my C# program.. All assistance is appreciated. xRuntime wrote: Side comment: you need some better smilies, that guy looks like he's biting his tongue off or eating a candy bar than sticking his tongue out... What about this Or Hello, See: System.Diagnostic.Process.Start("java compiler path", "command linearguments as javaprogram path"); Method First Parameter is path of the file to execute and second parameter is command like arguments to that exe. I hope you know what to do next . ...Show All
Karl Hulme Very Beginner and want to learn how to program in C# or VB.NET
Is it a way of thinking the process to be able to understand the books I’m very visual so what would it be the best way for a non programmer to become a C# or a VB.NET programmer Please advice. So, there is no type of thinking process keep in mind when I'm seeing these videos Excellent videos: http://msdn.microsoft.com/vstudio/express/visualcsharp/learning/default.aspx Nope, the videos are pretty simple to start and work their way up as you learn. There shouldn't be a problem. ...Show All
ALFKI Change ReadBufferSize...
Hi there. I want to change the ReadBufferSize value of a Serial Port object. The ReadBufferSize property has the following form: public int ReadBufferSize { get ; set ; } When I am writting to my code port.ReadBufferSize = 300000, where port is the serial port object, nothing seems to happen. What might be the problem and what am I doing wrong I would really appreciate any help of you. Thank you in advance.. Hi, the property ReadBufferSize needs to be declared as follows: ---------------------------------------------------- 1)You need to have an int variable and then define property. private int nReadBufSize; public int ReadBufferSize&nbs ...Show All
sangminny Why ImageList can not dispose the image it contains?
It's strange that ImageList can not dispose the image it contains, when I invoke imagelist's dispose method. private void Form1_Load( object sender, EventArgs e) { ImageList images = new ImageList (); Image image = Image .FromFile( @"xxx\bookmark.png" ); images.Images.Add(image); images.Dispose(); this .pictureBox1.Image = images.Images[0]; } I have invoked imagelist's Dispose method, but the picturebox can still show the image in imagelist. Why Thank you very much. I will do a little test the solution....and I response... ImageList inherits its Dispose() method from Component. Component.Dispose() does nothing but remove the component ...Show All
mike11d11 How to remake this in C#...
Below is code from C++ file i'm trying to convert to C#: DWORD playerUnit[25]; DWORD addr; ReadProcessMemory (pD2, (VOID *)0x6FBCC1E0, &addr, sizeof(addr), &read); ReadProcessMemory (pD2, (VOID *)addr , playerUnit, sizeof(playerUnit), &read); This is my code: byte[] playerUnit = new byte[25]; byte[] bMemory = new byte[100]; IntPtr ptrReaded; ReadProcessMemory(pD2[0].Handle, (IntPtr)0x6FBCC1E0, bMemory, sizeof(byte), out ptrReaded); ReadProcessMemory(pD2[0].Handle, (IntPtr)bMemory, playerUnit, sizeof(byte), out ptrReaded); In the C++ code, I can see that the information read from "0x6FBCC1E0" is stored in "addr." I've been able to write that much, but now I'm stuck. Next, In ...Show All
dsMqplp Listen On a Certain Port
I dont know if this is the right place for this.. but lets hope so... Im trying to create a simple... app that will listen on a certain port.. but for some reason It listen.. the program starts but.. then it ends... I also dont get any errors.. So Im a big lost here.. using System; using System.Net; using System.Net.Sockets; class internetcheck { public static void Main( ) { new startConnection(); } } class startConnection { public startConnection( ) { Socket socket = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp ); IPAddress ipaddr = IPAddress.Parse( "127.0.0.1" ); IPEndPoint endpoint = new IPEndPoint( ipaddr, 888 ); socket.Bind( endpoint ); socket.Listen(2); //soc ...Show All
HirenK How can I retrieve advanced file information?
...Like the Title of a song, the Bitrate, Album, etc. Thanks, Year only shows up as 3 digits, and it's four in the properties window. Why is this try this: Dim theFileStream As New FileStream (PathToFile , FileMode.Open) Dim theByteBuff(128) As Byte theFileStream.Seek(-128, SeekOrigin. End ) theFileStream.Read(theByteBuff, 0, 128) theFileStream.Close() Dim theEncoding As New System.Text.ASCIIEncoding() Dim theTagInfo As String = theEncoding.GetString(theByteBuff) If theTagInfo.Contains( "TAG" ) Then Dim theTitle As String = theTagInfo.Substring(3, 30).Trim() Dim theArtist As String = theTagInfo.Substring(33, 30).Trim() Dim theAlbum As ...Show All
Michael Hansen Abstract Generic Base Classes... how to refer to the derived type?
Hello all, my first time posting here on MSDN, so be easy on me. :) I have an abstract base class that takes a generic type parameter to strongly type a member. So, I have something like: public abstract class BusinessObjectBase<INFO> : IBusinessObject where INFO : EntityBase { public IBusinessObject Update() { ... } } ... public sealed class User : BusinessObjectBase<UserEntity> { ... } My issue is, I'd like to have a method pass back a saved version of the business object back from the Update() method; however, there doesn't seem a way to do this in a strongly-typed way. From the User, object, I can only pass back either a type "object", type "IBusinessObject", or type "BusinessObjectBase< ...Show All
austriana Detecting service pack?
How can I programmatically detect which service pack has been installed on the client machine http://support.microsoft.com/default.aspx kbid=318785 http://blogs.msdn.com/robvi/archive/2004/02/17/75272.aspx Whew! Working with unmanaged interops is kinda out of my league at this point. Is there a managed option in the .NET framework 1.1 This is helpful; but I'm not seeing anything that says it's detecting Windows XP Service Pack 1. How would I do that programmatically Thanks for the help. I didn't see anything about Windows XP Service Pack in your original post either ;) Anyway, call GetVersionEx , passing a OSVERSIONINFOEX struc ...Show All
Mutola Issue with user impersonation and Processes ! - Medium
Hi, I am wirting a program to execute a process under a user (B's) context ie. by impersonating a user. Assume Im the user (A).Following are the steps I have followed : 1. Created a WindowsIdentity object using the new user's user name and password i.e. user (B). 2. Impersonated the user (B) using WindowsImpersonationContext class. 3. Create a new Process object to start the command prompt (cmd.exe) and pass the arguments as "/c C:\ConsoleApplicaton1.exe". 4. The ConsoleApplication1.exe is a C# console application. This application gets the current WindowsIdentity and displays the name. WindowsIdentity .GetCurrent().Name; When I execute this program, the command prompt gets opened and the user name appears (A). Idea ...Show All
Asiye ToShortDateString format
Console.WriteLine(DateTime.Now.ToShortDateString()); This line prints: 03/01/02007 Why In Regional and Language Options dialog on my computer I see: Short date: 03/01/2007 Solved. It was according to short date format in the Regional Settings: dd/mm/yyyyy. In the Regional and Language Options dialog, what is the current format set to (e.g. "English (United States)", "French (France)", etc.) Have you customized the short date format string at all -Tom Meschter Software Dev, Visual C# IDE It is set to English (United States). But short date is set to dd/mm/yyyy - possibly I changed this, I don't remember. I wonder why additional 0 is ...Show All
