|
Here is my code, im not sure if im even tackling this problem correctly.
<br />
private void listView1_KeyDown(object sender, KeyEventArgs e)<br />
{<br />
if (e.KeyValue == 40)<br />
{<br />
ListViewItem temp = new ListViewItem();<br />
ListViewItem temp2 = new ListViewItem();<br />
for (int i = 0; i < listView1.SelectedIndices.Count; i++)<br />
{<br />
if(listView1.SelectedItems[i].Index + 1 <= listView1.Items.Count)<br />
{<br />
temp = listView1.Items[listView1.SelectedItems[i].Index + 1];<br />
temp2 = listView1.Items[listView1.SelectedItems[i].Index];<br />
<br />
listView1.Items[listView1.SelectedItems[i].Index + 1] = temp2;<br />
listView1.Items[listView1.SelectedItems[i].Index] = temp;<br />
}<br />
}<br />
}<br />
}<br />
|
|
|
|
|
Hi,
there is a bug: if the last listview item is selected (the one with index=count-1),
then temp will refer to the one with index=count, which exceeds the array.
there probably is a second bug: if items 2 and 3 are selected, then maybe
first 2 and 3 get swapped, then 3 and 4 get swapped, which might not be what
was intended.
index 0 1 2 3 4 5
So original A B C D E F
becomes A B D C E F
then A B D E C F
Also I am not sure the items in SelectedItems are in numerical
order, in selection order, or random order.
Furthermore, there is no need to create new ListViewItems (temp, temp2).
Hope this helps
-- modified at 3:39 Monday 16th April, 2007
|
|
|
|
|
Im really stuck
|
|
|
|
|
Since this is not a question, I will only give a piece of advice:
- try to formulate a good, detailed and complete description of what you
want to achieve before you start implementing something
(e.g. what is swapping meant to do when three things are selected ?)
- then implement, test and debug it
- if stuck in a very specific thing, read the documentation, search Google or
codeproject, possibly launch a question here
- if stuck in general, publish all the above plus detailed description of the
behavior you observed and what it is you dont like about it.
|
|
|
|
|
I use below conection string, but there's appear error in remote connection.
On same pc connection is OK.
mConnection = new SqlConnection(@"data source=servername\sqlexpress;" +
"database=databasename;" +
"UID=user;PWD=pass;");
Error mesage is:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Server Authentication is SQL Server and Windows Authentication mode.
Allow remote connections to this server is set.
What may cause this mistake?
Thanks.
|
|
|
|
|
Hi,
Your problem is that SQLExpress server by default has Named Pipes and TCP/IP protocol disabled. In order to connect to SQLExpress on different networked PC you should enable at least one of this protocols and restart your SQLExpress service under:
SQL Server Configuration Manager :: ... Network Configuration :: Protocols for ... :: Named Pipes and (or) TCP/IP.
Also it could be (but not necessary) required to setup client protocols on client PC.
Some other settings may be required on your firewalls and ...
After that, it should works.
damir@iit.com.hr
|
|
|
|
|
Thanks a lot Damir, it's works!!!
|
|
|
|
|
Go to the SQL Server 2005 configuration and set the required seting for remote connection
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
I have a NotifyIcon object. The user sees it near the clock on the desktop.
Now, I want to tell the user that something happend (Like when Windows says
that updates are ready to be installed)- a small baloon that comes out of
the icon.
Does anyone knows how to do it?
C#
|
|
|
|
|
Have you tried the ShowBalloonTip method?
---
single minded; short sighted; long gone;
|
|
|
|
|
Can you tell me more clearly. And I have VS 2003. Is that class here?
C#
|
|
|
|
|
C# programming wrote: And I have VS 2003. Is that class here?
That would explain it. That method is only available in framwork 2.
---
single minded; short sighted; long gone;
|
|
|
|
|
There are several articles on this topic. Search CP !
|
|
|
|
|
Hi
I am looking for some basic tutorial to send data[SMS] to mobile via COM port. Any help will be appreciated.
Thanks
|
|
|
|
|
Hi,
Can anybody tell me that how i can communicate with the USB port ?i want to make a simple program (at that time) in the visual studio c# ,such program has ability to on/off the LED connected to the USB port. Please guide me..........
|
|
|
|
|
Ummm, I don't think "simple" describes what your trying to achieve.
You will need some kind of develepment baord which will contain some kind of usb controller. Some of these use flash firmare which you can rebuild to your own requirements (perform your functions).
The .net framework was not designed to perform low level usb communications so you'll probably end up using a third party library.
A quick search on google pulled up these links:
Basic USB - Using Microchip Stack and C#.Net - Hardware
USB and C#
The USB library for .NET
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
i want to save entire data from my system to remote system. is it posible? can anybody guide me? by using remoting we can access remote system files. but i want save into the remote system. how can i?
|
|
|
|
|
Yes, it's more than possible. I don't know your specific requirements, but I can suggest some general approaches we normally use:
1) Using OS service directly, such as network drive mapping.
2) Using low-level IPC, such as socket and RPC.
3) Using high-level IPC, such as Remoting, DCOM and Web Service.
Best,
Jun
|
|
|
|
|
Hi guys,
i'am looking for a tutorial / reference
to make application SMS receiver
using .NET(C#)
i never do that before,
so i want to find a simple basic learning from site,
did anyone have a clue / recommended site?
thanks guys.
|
|
|
|
|
You have the chioce of using a GSM modem or a SMS gateway service.
A GSM modem will use an AT command set similar to a traditional modem which would allow you to 'query' the modem perhaps using a serial COM port.
A SMS gateway is likely to impliment thier own API or Web Service which you would consume in your application.
In both cases, the implimentation is likely to differ based on the service or hardware your use. You will therefor need to refer to the documentation provided by the manufacturer or service provider.
The following links may help:
SMS Gateway
GSM Modem
Introduction to SMS Messaging
Hope this helps
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
Hi, i have a listview with paths to programs. I want to create a loop which opens the program, and when it closes opens the next.
<br />
foreach(ListViewItem lvi in listView1.Items)<br />
{<br />
Process.Start("\"" + lvi.SubItems[0].Text + "\"");<br />
}<br />
How do i detect then the program closes?
|
|
|
|
|
You need to get a handle to the process you start and watch if it closes. I know how to do this in C++, not sure about C#
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Could you please provide the code in C++?
Is it something like this?
[DllImport("user32.dll")]<br />
static extern uint FindWindow(string lpClassName, string lpWindowName);<br />
<br />
int handle = FindWindowEx(0, 0, "Notepad", null)
Then detect if it closed?
Not sure how to do that anyway.
|
|
|
|
|
No, you can call a variation of shellexecute that returns the handle and then you call an API that waits for that process to finish.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Process.Start returns an instance of the Process class representing the program you started. Hence this should work (at least the idea, I did not run it):
Process.Start("\"" + lvi.SubItems[0].Text + "\"").WaitForExit();
|
|
|
|