|
Socket connections can have either connection closed first. The documentation describes how to close an open socket. (Depending upon how a socket is opened, closing a reader or writer may close the underlying socket. Just use some try/catch handlers with Trace.WriteLine(err.ToString()) to catch and understand any errors with what you try.)
John
"We want to be alone when we hear too many words and we feel alone when it has been a while since anyone has spoken to us." Paul David Tripp -- War of Words
|
|
|
|
|
can i embed internet explorer in my application?
if possible please guide me on this
ASIM
Asim
|
|
|
|
|
Yes, you can do it in some ways, the easiest one is customizing the toolbox and adding from the COM Components tab, the "Microsoft Web Browser" (\system32\shdocvw.dll), then you just need to drag it to your form. To get more information about how to use it check this link
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/browser_control_node_entry.asp
|
|
|
|
|
thank u very much sir.
i got it.
ASIM
Asim
|
|
|
|
|
http://www.codeproject.com/books/0764549146_8.asp
|
|
|
|
|
|
Does anybody knows how can i actually access metadata of files?
i am interested in accessing the title and author information stored in word(.doc) files. if you go to the windows explorer and press right click and properties on a .doc file you will see this info.
Thanks in advance
|
|
|
|
|
My mdi app has a navigation screen on the left hand side with link labels that when clicked will decide which form will get displayed on the right hand side. I want to pass a parameter to the eventhandler whenever a link label is clicked but I don't know how to do this. Please, can any one show me how?
So if I have the code below, how can I pass formName to the OnClick method where the formName depends on the link label they click.
public class Home
{
private void InitializeComponenet()
{
button1.Click += new System.EventHandler(OnClick);
}
private void OnClick(string formName)
{
eventHandler(formName)
}
}
|
|
|
|
|
Look at delegates and EventArgs. That will show you how to pass parameters on events.
If you have a main MDI window which creates your MDI child windows and the navigation is a MDI child window that you can only have one of (I am thinking of a left side tab strip type of navigation while the right side hosts all the MDI windows). If this is the case, your main window will have the reference to your navigation window (since it creates it). You could have your main window pass a reference to your navigation window to your MDI children windows. They would then be able to pass the event information directly back to the navigation window would having to raise events.
MainForm
NavigationWindow navWindow = new NavigationWindow();
...
// Some event happens and child window is bring created
MyReportChildWindow child = new MyReportChildWindow(navWindow);
NavWindow
public void OnSpecialClient(string formName)
{
// Do something
}
MyReportChildWindow
private NavigationWindow navWindow = null;
public MyReportChildWindow(NavigationWindow navWindow)
{
this.navWindow = navWindow
}
public OnClicked(object Sender, EventArgs e)
{
navWindow.OnSpecialClient(this.Text);
}
There are other ways to handle this situation. With delegates you will have to have either the Nav window or the Child window know each other in order to register the delegate unless you had the main window set the delegate for the child window when it was created. Would be easier with the above than that.
Another possiblity, is if there will only ever be one Navigation window, you can have it have a static member that you can call from all your child windows. That way you do no thave to pass anything, you could just call NavigationWindow.OnSpecialClient(this.Text) when the event occured. This kind of make the NavigationWindow method global to your application.
Rocky Moore <><
|
|
|
|
|
Thanks for your reply, but I am still not clear on how to implement what I am seeking. I know I have to create a class that derives from the System.EventArgs base class, but I am not sure how creating this class ties in with everything else. For example, where do I instaniate this class, how does that relate to onclick and the type the method takes. Any help is appreciated.
|
|
|
|
|
Hi there,
I have a file called exmple.aspx created in a notepad and it ran well in a IE web browser and i enjoyed the result. But as i want to run it in the visulastudio IDE, i created a project, SampleProject and right click on the project added a webform and named it as exmple.aspx. copied the code from the original file(notedpad) and saved it, tried to run the file by right clicking it and choosing the option 'view in browser' but unfortunately it displayed the following error .
Server Error in '/SampleProject' Application.
--------------------------------------------------------------------------------
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'SampleProject.Global'.
Source Error:
Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="SampleProject.Global" %>
Source File: c:\inetpub\wwwroot\SampleProject\global.asax Line: 1
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.0; ASP.NET Version:1.0.3705.0
I am new to visualstudio.net and ASP.NET. I am not sure the way i created example.aspx in visualstudio IDE and ran it was correct. Please help me in understanding and how to overcome this problem.
thanks in advance.
dev
|
|
|
|
|
Try compiling the project prior to viewing the page in a browser. When you right click on the page, select "Build and Browse".
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Hi friends!
Would someone please tell me what may be the reason for somebody to choose C# instead of VC++ to create windows applications? I think C# is only proper for WEB applications that don't need realtime capabilities.
Does have C# any capability that VC++ doesn't have it?
Your comments will be greatly appreciated
Don't forget, that's <font color="blue">" Persian Gulf "</font> not Arabian gulf!
|
|
|
|
|
Unless you meant Managed C++ applications instead of VC++, your question is a bit off. Wouldn't it be more like "Why would you use .NET to create Windows applications instead of the Windows API?"
The first question is, what kind of market do you wish your application to target? Does your product plan to access information on the net? Is your product client/server or n-tier? Will your program target Windows 95? Are you interested is cross platform development?
These are just a few of the questions to help decide which tool to use. With .NET you can make robust applications that are extreamly scalable with easy modular design that can share code between a web application or windows application without recoding. With .NET remoting, you can distribute your application workload over multiple computers or over the Internet without changing your code. You can even run modules in your application in multiple sections (AppDomains) to protect modules from crashing and taking down the others.
Unfortunantly, Microsoft has done a loosy job at marketing .NET. Most people think of .NET as a web or internet platform. There is much more to it, and I cannot describe all that here.
The .NET frameworks provides the programmer with object oriented platform. There are over 8,000 classes in the .NET frameworks and they can be accessed from either a web application or a WinForm (Windows) application.
For .NET you can use any of the .NET languages included Managed C++ if the speed is required. C# just happens to be one of the languages which happens to have a lot of the flavor of C++ without all the hassles. I have been a C++ programmer since Windows 3.0 and find it very natural to use C# now (having been working full time with it for the last seven months) and hate to use C++ anymore. There are a lot of gotchas and things you just have to eat and not worry about, but the end result comes a lot easier and a lot less debugging.
For me, C# and .NET has made me move more object oriented than I ever. It is so easy to break a program up into modules that can easily be remoted, this I would not have thought of usually with C++. I personally have just about kissed COM/DCOM off. Don't need it anymore. While there are some time legacy programs you have to communicate with, if all the code is new and you can ran everyone on .NET, why bother. Although some people that have invested in lots of COM modules might disagree
Another major point for me, is the movement to run .NET and C# on other platforms. Mono project has been working on a compatible WinForm (Windows applications) and WebForm to run on Linux. There are some cross platform applications starting to rise even though they do not have it 100% complete. It seems funny to design Linux GUI applications and be using C#. I expect to see much more this direction as long as Microsoft does not put down their foot.
Those are just a few of the reasons I use .NET and usually do not bother with other technologies. C# is my new language of choice and personally, I could care less if I ever see one line of C++ code again.
Rocky Moore <><
|
|
|
|
|
Thanks a lot Rocky , but would you please clarify some things for me? They are:
-Don't you think that installing .Net framework on every computer using .Net applications is somehow a dirty requirement? Suppose you have developed a .Net application and you want to sell it, you should say to customers: "Please first download .Net framework!"
-Do you feel the lack of some things like ATL in C#?
-Is it possible to develop high speed applications with C#? For example suppose a robot which should do a fast reflection after processing an image. Does have C# the same performance as VC++ in this situation?
Thanks again! ;)
Don't forget, that's <font color="blue">" Persian Gulf "</font> not Arabian gulf!
|
|
|
|
|
Meisi wrote:
Don't you think that installing .Net framework on every computer using .Net applications is somehow a dirty requirement? Suppose you have developed a .Net application and you want to sell it, you should say to customers: "Please first download .Net framework!"
(1) If you are distributing your software on CD, you can distribute the .NET Framework on your CD, and then they won't have to download it.
(2) Even if they do have to download it (because they're downloading your software, or whatever), they'll only have to do it once, and chances are getting higher and higher that they'll have already done it by the time they want to try/buy your software.
Meisi wrote:
Do you feel the lack of some things like ATL in C#?
You know, I haven't used ATL myself, but it seems to me that the .NET BCL partially takes it's place. Also, in .NET 2.0 there will be Generics (read: templates) available in C#.
Meisi wrote:
Is it possible to develop high speed applications with C#? For example suppose a robot which should do a fast reflection after processing an image. Does have C# the same performance as VC++ in this situation?
Yes, it'll be somewhat slower, but to me, it's worth it.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Meisi wrote:
-Don't you think that installing .Net framework on every computer using .Net applications is somehow a dirty requirement? Suppose you have developed a .Net application and you want to sell it, you should say to customers: "Please first download .Net framework!"
Nope, not dirty at all. From this point on in time at Microsoft, .NET will be part of the OS. No more downloading. Currently, .NET is an update module for the standard Windows Update and many people have already installed it not even knowing what it was.
As time goes on I expect to see it already on systems. There are many new programs coming out that rely on .NET. I was surprised to hear on the ScreenSavers on Tech TV (a show for geek type people on the tech tv channel) that one of their top picks for RSS view was a .NET viewer and they mentioned it required .NET to be installed. There will be many more software products hitting the shelves that people will want to use and they will require it.
It is a lot like COM. In the early days we wondered how we could justify forcing everyone to update to have COM available (showing my age again). While it seemed at the time it would be a hard sell to some, it took over.
Meisi wrote:
-Do you feel the lack of some things like ATL in C#?
It is not "lack of", in the older days I could write about any kind of program for my Commodore 64 computer that I could find on a IBM compatible, but it would take less time, be easier to create and have a future if I built it on my IBM compatible computer (again showing my age at pre Windows OSs ). The future is .NET. That is simple and no two ways about it. Do you write code today that will soon be considered "legacy" or just start writing for the future. Usually, an application of any serious size will take 6-18 months. At that end of that cycle, .NET will be on most Windows based computers and I believe on many Linux machines as well.
Meisi wrote:
-Is it possible to develop high speed applications with C#? For example suppose a robot which should do a fast reflection after processing an image. Does have C# the same performance as VC++ in this situation?
No, C# or any managed language in .NET will be hugely slower than VC++ calling native Windows API. I expect this to continue for a year or two until .NET V4 or something like that. Remember, with Microsoft it is usually several versions before they take over the world. Happend with Windows, happened with IE, .NET is no different. But they have created a VERY good version 1.0!
If you need raw horse power graphics such as a video game, there is little need for .NET. As in the old days, those type of applications where all DOS based until many later versions of Direct-X. Now many of the games are native to Windows. Same thing coming down the road for .NET.
I personally think that Microsoft has been surprised. They were originally thinking of tools to help build backend, mostly networked based applications and interfaces. Once developers got their hands on C# and WinForms, it probably surprised them to see how quickly we adapted to them and wanted to go further down that road. They know now and and planning for it this time.
There I go again, start typing and it just don't stop. And I don't even get paid for pushing .NET on everyone
Rocky Moore <><
|
|
|
|
|
The way you answer my questions, encourages me to ask more and more...;)
My friend says C# is a managed language and will never have good performance as vc++ has. But you say we should wait for 1 or 2 years and it will happen as happened for other Microsoft products. So I am confused and you should clarify!
Thanks a lot
|
|
|
|
|
Meisi wrote:
My friend says C# is a managed language and will never have good performance as vc++ has.
It depends on the type of application. VC++ will not give you much different from C# when you are building normal data driven business apps. Now, if you look and development time and debugging, you are talking a major time diference as VC++ will take longer and require far more debugging (unless you are a perfect programmer and never make typos or errors in logic ). The current .NET works wonderful for this type of application while VC++ really lags behind.
Now, if you are developing a cpu consuming graphical game or CAD program, they C# would be very slow in its current form. In the future I would imagine we will see the line blur more.
So, basically, it is the type of application and how much time your want to spending building, debugging and maintaining.
Another aspect is if you plan to do any web work. Designing apps in C# for Windows and C# for the web allows you to share a lot of the code with little work. In VC++ it is a royal pain since you would be wrapping your C++ in COM to access it from scripting on the web site or digging ISAPI plugins for your web site which is still a pain. With C# you will be able to take most of your data and business logic and simply call it from you web application just as easy as your Windows application.
Rocky Moore <><
|
|
|
|
|
I'm trying to do a drop-down color picker, more or less using the same design as Watson39's code (here:http://www.codeproject.com/cs/miscctrl/color_picker.asp). What I find is that if you do ShowDialog() on the form, it goes Modal, and of course, you can't access the app that called it to click off the color picker and basically cancel. If you go with the Show() option, you end up losing focus on your app (it becomes "inactive") and you have a new, blank icon in your alt-tab window. I've tried setting the owner and parent of the color picker to the TopLevelControl of the calling control. No love. Anybody have any guesses on how to solve this?
thanks,
~Pb
|
|
|
|
|
With menus and combo dropdowns, you grab the mouse capture with SetCapture() when the mouse is outside your menu, and release the capture with ReleaseCapture() when the mouse is inside your menu (so that any contained controls can get mouse messages). So this would be the way to do it here. You will also want to close the popup when it recieves a WM_APPACTIVATE message where the app being activated is not your own.
I had been struggling with this with my CommandBar, but when I discovered this way, everything worked perfectly.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Those methods don't exist on a C# Windows Form, which is what my drop-down is. I'm not quite sure what the equivelant would be, either. I'm not having any trouble capturing the events, or for that matter, getting the forms to be active appropriately. At this point, the only problem I'm still having is that when the drop-down occurs and the form is show, the main app's form becomes inactive, which should not be the case for a drop-down menu.
Thanks ~Pb
|
|
|
|
|
Patrick Bristow wrote:
Those methods don't exist on a C# Windows Form, which is what my drop-down is. I'm not quite sure what the equivelant would be, either.
Just use the APIs.
Patrick Bristow wrote:
the only problem I'm still having is that when the drop-down occurs and the form is show, the main app's form becomes inactive, which should not be the case for a drop-down menu.
Did you set the WS_EX_PALETTEWINDOW style?
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
jdunlap wrote:
Did you set the WS_EX_PALETTEWINDOW style?
According to MSDN, that's only going to set the form topmost and give it a raised border. By making it a child form, I've already made it topmost. And given the design I'm using, I don't really want a raised border. Unfortunately, none of that solves the fact that the window takes the focus away from the main application, which I don't know how to stop. Really, it's just appearance, but most apps don't have this problem, and I'd like to fix it.
Thanks, ~Pb
|
|
|
|
|
|