|
Thanks you very much Colin and Stefan
I have been able to do what i want in C#.
However, i have one more question.....
Can i do it in VB.net too ??
|
|
|
|
|
As far as I know it's not possible, because VB.NET doesn't support the XML documentation.
But I'm sure there are other ways to accomplish the same, so try posting this in the VB forum.
www.troschuetz.de
|
|
|
|
|
Can somebody please show me an example of a foreach loop with a ListBox's SelectedItems collection ?
Here is what I have.
foreach (object item in listBoxPlaylist.SelectedItems)
{
this.listBoxPlaylist.Items.Remove(item);
}
object item is the problem I think, I also tried ListBox.SelectedObjectCollection item .... I'm not sure what to put there. I get an InvalidOpperationException.
What I want to do is remove the selected items from the list box.
/\ |_ E X E GG
|
|
|
|
|
Well, the first thing that comes to mind is that a foreach loop is special. Special in a way that the collection you are foreach-ing must not change during the foreach. So if items are removed, they probably also are not selected anymore and thus are removed from the selected items list. This might work, but should cause an error.
The error is probably because of the foreach. The SelectedItems list is really a list of objects - anything can be the "identifier" of an item.
Try this:
while (listBoxPlaylist.SelectedItems.Count != 0)<br />
{<br />
this.listBoxPlaylist.Items.Remove(listBoxPlaylist.SelectemItems[0]);<br />
}
|
|
|
|
|
Thanks dude, it works perfect.
/\ |_ E X E GG
|
|
|
|
|
The problem is that it is not allowed to change a collection while iterating with foreach through it.
A solution would be (but there are many more):
<br />
object[] tmp = new object[listBoxPlaylist.SelectedItems.Count];<br />
listBoxPlaylist.SelectedItems.CopyTo(tmp, 0);<br />
foreach (object item in tmp)<br />
listBoxPlaylist.Items.Remove(item);<br />
|
|
|
|
|
hi code guys!
I've come to serious problem. I have a page with multiple frames. I want to access particular frame contents.
One solution is to use (mshtml innertext) property. but I have no idea how to use it in my c# app.
I need the code.
thanks!
|
|
|
|
|
Greetings!! I have been working on a project of a windows service and now i have a big problem. But after installing my new service i discover that the framework lib's don't work when the service starts ( when Windows Starts). I read about this problem in .NET and they say that only windows MFC Library is capable of this. I wonder if there is a class in c# for making possible the framework work on startup. In another way of explaining this my service starts but when I click on the service icon I don't get any result or sometimes I get Error when it shoud show a window I make.
This is my problem:::::::::::::::::::::::::::::::
Windows Service applications run in a different window station than the interactive station of the logged-on user. A window station is a secure object that contains a clipboard, a set of global atoms, and a group of desktop objects. Because the station of the Windows Service is not an interactive station, dialog boxes raised from within a Windows Service application will not be seen and may cause your program to stop responding. Similarly, error messages should be logged in the Windows event log rather than raised in the user interface.
The Windows Service classes supported by the .NET Framework do not support interaction with interactive stations, that is, the logged-on user. The .NET Framework also does not include classes that represent stations and desktops. If your Windows Service must interact with other stations, you will need to access the unmanaged Windows API. For more information, see Window Stations and Desktops in the Platform SDK documentation.
::::::::::::::::::::::::::::::::::::::::::::::
How can i resolve this???????????????????????
Please help me and sorry my bad English.
|
|
|
|
|
Well, you could make a program run when the user logs on and then use IPC to tell that program to pop up any windows you want. Not a very elegant solution, though - you'd have to make sure it runs for all users and even when users are added or removed... very messy.
Or you could use PInvoke to access any native DLLs that might support this sort of thing. Depends on how the plain old Win32 services do it, I suppose.
|
|
|
|
|
Well, this depends on several conditions:
Do you want your users to ALWAYS see pop-ups and information windows? Because that is not what a service should do.
A service should run in the background unattended.
IF you want your users to continously interact with your program, make it a windows-forms application. You can still "autostart" it via a registry entry.
Do you simply need some feedback for debugging purposes and want non-critical errors to be described somewhere? Then use this.EventLog.WriteEntry.
That will allow you to write some output to Windows' application event log.
If you want an local user or administrator to be able to change the settings of your service, you could use an ini-File which holds configuration information, so someone could simply edit the file to change settings (or store those settings in the registry).
If you need remote-configuration capabilities, have an asynchronous tcp socket waiting for connections on a certain port and use net.security or a simple user/password combination to restrict access.
Then send commands and have your service react accordingly. You could even write a Windows-Forms App to communicate with your service.
I chose the latter (ini-file and remote config) for my Windows Service.
Cheers
Sebastian
|
|
|
|
|
I need some help with the dll from dymo.
I can open a label and print it but how do i change the text of textattributes before printing the label ?
Thanks for a helping source ...
|
|
|
|
|
When I am trying to step through the code, I'm getting the error
There is no source code available for the current location.
There are no imported objects from 3rd party code, I have a lot of custom classes, all of which are available to the program. If I set a break point at the class, it will allow me to step into it. Then I'll get the error on the first call of a method of the class. If I set a breakpoint there, run to that breakpoint, then step, it'll work until the next call to a method.
I've rebooted, I checked the computer for bugs. Everything was working fine until this morning. The only thing I've changed was the order some of the user defined forms are loaded (which changed the order of some of the class loads) but that doesn't seem like it could stop the application from seeing its own classes.
|
|
|
|
|
If I didn't know better, I'd swear the system was threading and it isn't keeping up with itself. If I set a breakpoint, and wait a few seconds between each step, it will work. My best indicator is that the form seems to refresh between each step (which is a pain because I have to minimize, then maximize VS in order to put VS back in the foreground to see the code to continue stepping). If I step too quickly, I will get the above error.
Machine: 2.4Ghz w/ 1G memory
|
|
|
|
|
Hi
I am new to C# and currently reading some books and very interested in buying C# 2005 but would like an advise on C# functionality before spending my money.
I am planning to make a C# application that displays HTML pages by clicking on a treeview component. HTML pages will supplied during programming. Questions:
1- What is the easiest way to display HTML document in a Windows Form
2- After building the application, will all html documents be visible in installation directory or will be compressed (just to make sure nobody edit them)
Regards, Adel.
|
|
|
|
|
Adelm wrote:
1- What is the easiest way to display HTML document in a Windows Form
Best way to display HTML in Windows Forms is to use Internet Explorer control. This control will be available in C# 2005 (like typical .Net control), but it is possible to use it in current version also (In Toolbox click on "Add/Rmove Items" and select "Microsoft Web Browser" on Com Components page).
You can navigate browser control to html page from html file, from url and also to resource of win32 dll file (something like res://C:\WINDOWS\system32\shdoclc.dll/navcancl.htm).
|
|
|
|
|
There's going to be a .Net control for the IE window in C# 2005? That's sweet. Using the Microsoft Web Browser is great and all, but sometimes it's a pain. I hope that the .Net control will be a little easier to work with. Is there anywhere where I can go to read up on it?
|
|
|
|
|
|
Thanks Tomas. I will try the beta version of C# on Microsoft web site and findout if this .net control is included.
|
|
|
|
|
hi there
i wrote a C# Application
in my pro i have some reports by Cr
in my PC every thing work fine and i can see all the reports
but when i am traying to see the reports in antother pc
its not working an i get exsptions
Crystal decion are not found something like that
maybe i need a jet engin ?
there is someone can help me ?
why i cant run the reports in antoher computers ?
i am working whit VS 2003 and the Crystal reports is bullit in .
lang C#
|
|
|
|
|
You need to visit the Crystal Reports website and register the version that came with your VS 2003. Then you need to read their install/use PDF. It tells you which files you need to include in your project and how to register the license to that project.
|
|
|
|
|
Someone wrote an article earlier this week on using PInvoke to execute x86 Op Codes from within a C# application.
For the life of me, I cannot find it. Can anyone point me in the direction to that article?
|
|
|
|
|
|
|
I have 2 treeviews in an application.While I am dragging a node from a treeview to a node in other treeview I want to get the name of these two nodes(one of is dragging node ,the other is dropped node)How can i get these nodes?
Thanks for your help...
|
|
|
|
|
Hi
I make a C# usercontrol.
in the load event of the control I want to do some work only if the control is in run time so i check for the DesignMode property:
if(DesignMode) return;
but the DesignMode is always false.
anyway to solve this ?
|
|
|
|