|
try ListView.Items.Clear() to clear the content, not the view itself.
|
|
|
|
|
beat me to it
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
try listView1.Items.Clear();
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
|
i am new to c# i want to develop a social web site like twitter.com with all those features of twitter,orkut..etc where can i find tutorial like books,videos etc i am a student my pocket money is not enough to survive for even a week so please i cant pay for the tutorials help me out it's the first project of my life
|
|
|
|
|
Aren't you starting with your targets a little high?
I suggest you take a look at a few of the articles in the Web development section and get started there
|
|
|
|
|
can u tel me which article to look i am a bit confused and tensed.
|
|
|
|
|
Hello,
I need a way to embed an editable Excel worksheet in my C# application so my users can input data. One of the main reasons I would like to use the excel worksheet is to allow them to enter data into multiple columns with varied number of rows. I wish to then collect the data in the application and process it. I have created a new project and was able to use the control in my form however, I do not know how to extract any data from from it. Can anyone point me to some examples or documentation that will assist me. Any help would be most appreciated.
Thanks!
|
|
|
|
|
here[^]
here[^]
here[^]
and
here[^]
If you had just done that yourself you would have got your answer quicker
|
|
|
|
|
Hi, buachail
I tell you I did, but probably not use the right key words.
this is the cute way to answer, but it really scares me - I was not sure if there are a whole bunch of bugs lurching behind those links!
Thanks.
|
|
|
|
|
I'm having a rough time creating a DataTable with the contents of an SQL "SELECT" and I'm pretty sure I'm just missing 1 line of code. The program runs without error as is, but the DataTable myTable remains null even after txtMemNum_TextChanged is run.
The goal of the method txtMemNum_TextChanged will be to continually populate a DataGrid with potential matches from an SQL server as the user types the member number in the textbox txtMemNum. Any help is appreciated. -Tim
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private SqlConnection OpenConnection()
{
SqlConnection myConnection = null;
string connectionString = "Integrated Security=SSPI;" + "Initial Catalog=Sales;" + "Data Source=PC-HERE\\SQLEXPRESS;";
try
{
myConnection = new SqlConnection(connectionString);
myConnection.Open();
return myConnection;
}
catch (Exception ex)
{
MessageBox.Show("Error in connection: " + ex.Message);
myConnection = null;
return myConnection;
}
}
public void AddRow(SqlConnection myConnection, long memNum)
{
DataSet mySet = new DataSet();
string selectString = "INSERT INTO Members ([Member Number]) VALUES (" + memNum + ")";
SqlCommand myCommand = myConnection.CreateCommand();
myCommand.CommandText = selectString;
SqlDataAdapter myAdapter = new SqlDataAdapter();
myAdapter.SelectCommand = myCommand;
myAdapter.Fill(mySet, "Members");
mySet = new DataSet();
selectString = "INSERT INTO Sales ([Member Number]) VALUES (" + memNum + ")";
myCommand = myConnection.CreateCommand();
myCommand.CommandText = selectString;
myAdapter = new SqlDataAdapter();
myAdapter.SelectCommand = myCommand;
myAdapter.Fill(mySet, "Sales");
mySet = new DataSet();
selectString = "INSERT INTO Location ([Member Number]) VALUES (" + memNum + ")";
myCommand = myConnection.CreateCommand();
myCommand.CommandText = selectString;
myAdapter = new SqlDataAdapter();
myAdapter.SelectCommand = myCommand;
myAdapter.Fill(mySet, "Location");
myConnection.Close();
int hi = 0;
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void AddTruck_Click(object sender, EventArgs e)
{
long memNum = long.Parse(txtMemNum.Text);
SqlConnection myConnection = new SqlConnection();
myConnection = OpenConnection();
AddRow(myConnection, memNum);
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void txtMemNum_TextChanged(object sender, EventArgs e)
{
long memNum = long.Parse(txtMemNum.Text);
SqlConnection myConnection = new SqlConnection();
DataSet tableSet = new DataSet();
string selectString = "SELECT * FROM Members WHERE [Member Number] LIKE '" + memNum + "%'";
myConnection = OpenConnection();
SqlCommand myCommand = myConnection.CreateCommand();
myCommand.CommandText = selectString;
SqlDataAdapter myAdapter = new SqlDataAdapter();
myAdapter.SelectCommand = myCommand;
DataTable myTable = tableSet.Tables["Members"];
int hi = 0;
}
}
}
|
|
|
|
|
I don't see a Fill, and even then the table won't be named "Members".
There are a number of other concerns with your code.
|
|
|
|
|
Thanks for the response.
What concerns do you mean? I actually thought the code was pretty clean(despite the naming conventions I used when passing variables and not try catching the Parse's.
By all means, tear it apart. No one ever got any better without being corrected in their mistakes.
|
|
|
|
|
|
Hi All,
I'm predominately a Java programmer usually but have been doing some work in C# of late and am having a problem I hope someone can shed some light on for me.
There is a client and a server component to the application I'm writing. The way it works is that the client connects to a lot of servers that are running on a LAN (31 to be precise). All the servers expose a singleton MarshalByRefObject that is used by the client to call methods on the servers.
The client, when run, attempts to connect to all the servers at once, spawning a thread for each connection which basically just does this:
<code>
while (true)
{
try
{
RemoteInterface ri = (RemoteInterface)Activator.GetObject(typeof(RemoteInterface), url);
cparams.Callback(connectParams.ServerNumber, ri);
break;
}
catch (Exception ex)
{
log.Error("Error connecting to server " + cparams.ServerNumber + ": '"+ ex.Message+"'");
}
}
</code>
So attempting to connect to the server repeatedly, executing a callback (then terminating) when it's successful or logging errors each time it times out (or some exception occurs).
The problem I'm having is that when, say, 30 of the servers are down, and 1 is connected remoting calls to that server's RemoteInterface delay for something like a minute when they are performed. It's almost as if the other threads attempting to connect to the other servers are interfering with the thread that's making the call on the RemoteInterface of the connected server. I'm really unfamiliar with Remoting as this is the first project I've worked on that uses it so any help with finding a possible cause of this slowdown would be greatly appreciated. It seems to me that there is some singleton resource being shared by all the remoting threads that's blocking them and letting only one through at a time? I really don't know enough about remoting to speculate.
Thanks in advance,
Nick
|
|
|
|
|
I'm no threading expert so I may be way off here, but I think it might be because of the number of threads available in the .NET thread pool.
If you're exceeding the currently assigned maximum then until some threads are released, the others will just be queued until a thread becomes available. You can increase the number of threads available. Google will be your friend here. Search for '.NET Threadpool'.
There is also an excellent series of threading articles[^] on here that will be of interest and help.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
modified on Wednesday, April 15, 2009 3:58 PM
|
|
|
|
|
I'm using sendmessage so I need an IntPtr handle to the object I want to act upon.
how would I isolate the flash movie from a given site
I can post the site source if that would help you guys
I've been working on this for 2 weeks and haven't gotten anywhere
|
|
|
|
|
Hello, i have this application in C#.NET CF. The pda is connected wirelessly to a router, that is connected to a notebook through wire.
The notebook has a SQL Server 2005 Express running and I want to connect the pda with it, but i keep getting this "Access denied or Server not found" message.
I already configured the TCP/IP enabled inside SQL Server Configuration Manager and i don't know what to do next.
Sorry for the poor english.
Thanks in advance.
|
|
|
|
|
More information is needed? What Operating system is the notebook running? If it's Windows XP, that could be the reason.
|
|
|
|
|
Sorry, my fault.
Notebook - XP
pda - Windows Mobile 5
why that could be the reason?
|
|
|
|
|
I'm pretty sure that although SQL server will run on XP, it doesn't actually work.
Confirmation anyone?
|
|
|
|
|
I'm developing a small application witch scanning remote servers for TCP and UDP Ports (Open/Close).
About the TCP it's done.
But about UDP I’m facing a big problem with it .
I found a strategy I think it's helpful for that
By sending a UDP Message and receive ICMP server response but i don't know how to do this .
I need an answer ASAP or a code sample for how to do that.
Thanks.
|
|
|
|
|
Hello,
I am attempting to invoke the GetVersionVector method of the DfsrReplicatedFolderInfo on a remote machine.
After referring to two articles (1, 2) about the subject on InvokeMethod in C#, I have written the following code:
<br />
string TargetMachine = textBox2.Text;<br />
<br />
<br />
System.Management.ManagementScope oMs = new<br />
<br />
System.Management.ManagementScope("\\\\" + TargetMachine + "\\root\\microsoftdfs");<br />
oMs.Connect();<br />
<br />
System.Management.ObjectQuery oQuery = new System.Management.ObjectQuery("SELECT * FROM DfsrReplicatedFolderInfo");
<br />
ManagementObjectSearcher oSearcher = new<br />
<br />
ManagementObjectSearcher(oMs, oQuery);<br />
<br />
ManagementObjectCollection MgmtObject = oSearcher.Get();<br />
<br />
<br />
foreach (ManagementObject item in MgmtObject)<br />
{<br />
<br />
<br />
<br />
ManagementObject outParams = (ManagementObject)item.InvokeMethod("GetVersionVector", null);<br />
<br />
MessageBox.Show(outParams.ToString());<br />
}<br />
When attempting to InvokeMethod, the following error is thrown:
Object reference not set to an instance of an object.
If I do away with the cast and use declare outParams as an object instead, i get the same error.
Any input is appreciated,
Matt Brown
|
|
|
|
|
Here's the solution....
Tweak query as desired...
private void button7_Click(object sender, EventArgs e)
{
string TargetMachine = textBox2.Text;
ManagementPath path = new ManagementPath("\\\\" + TargetMachine + "\\root\\microsoftdfs");
ManagementScope scope = new ManagementScope(path);
SelectQuery msQuery = new SelectQuery("SELECT * FROM DfsrReplicatedFolderInfo");
ManagementObjectSearcher searchProcedure = new ManagementObjectSearcher(scope, msQuery);
object[] methodArgs = { "" };
foreach (ManagementObject item in searchProcedure.Get())
{
try
{
item.InvokeMethod("GetVersionVector", methodArgs);
foreach (string returned in methodArgs)
{
MessageBox.Show(returned.ToString());
}
}
catch (SystemException excep)
{
MessageBox.Show(excep.Message);
}
}
}
|
|
|
|
|
Hi,
what is the diffrent between synchronous and asynchronous communication in socket?
How can i handle many number of client in server using socket. can anybody provide some exaple f asynchronous communication in socket?
thankyou
YPKI
|
|
|
|