|
|
|
Hello,
Precondition.
1. The ListView control. have 5 columns.
2. This have 70 data.
I would like to remove data after add data on visual.
I could do it. but not visible.
After remove and add data on ListView and ListViewItem, I called Update() or BeginUpdate() & EndUpdate(). But These data didn't update.
The following is the source.
If you have some ideas, please tell me.
regards,
yu-yu
--------------------------------------------------------
lvListView.BeginUpdate();
while(i < lvListView.Items.Count)
{
if (lvListView.Items[i].SubItems[3].Text.CompareTo(sTemp[3]) == 0)
{
lvListView.Items[i].Remove();
break;
}
i ++;
}
ListViewItem items = new ListViewItem("WEB");
items.SubItems.Add(sTemp[2]);
items.SubItems.Add(sTemp[4]);
items.SubItems.Add(sTemp[3]);
lvListView.Items.Insert(lv参加者.Items.Count, items);
lvListView.EndUpdate();
|
|
|
|
|
Our scenario:
Multiple objects being hosted in a Windows services on Win2003 Server.
Up until now, we were running the server as an EXE, but since moving to a service all our errors are being returned as "Server encountered an internal error.".
We last saw this error when our exceptions were not supporting serialisation correctly.
Since changing the exception classes, the error went away and we haven't changed anything else since moving the server code into a service.
The code works 100% and the exceptions are expected, however the type and associated info about the exception is now not being preserved across the remoting boundary.
Is the behaviour of the remoting code different if it's in a service?
Cheers,
Simon
sig :: "Don't try to be like Jackie. There is only one Jackie.... Study computers instead.", Jackie Chan on career choices.
article :: animation mechanics in SVG blog:: brokenkeyboards "It'll be a cold day in Hell when I do VB.NET...", Chris Maunder
|
|
|
|
|
It shouldn't be (since a service is just an executable that's run by the SCM), but to satisfy curiousity (and hopefully help you solve the problem), have you tried checking the Exception.InnerException to see if you are getting what you expected?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
<br />
private void btnPrevious_Click(object sender, System.EventArgs e)<br />
{<br />
txtAcctID.Clear();<br />
<br />
if (Row == 0)<br />
{<br />
MessageBox.Show("You are at the first patient on the Queue","Beginning Of Queue");<br />
Row = 0;<br />
<br />
}<br />
else<br />
{ <br />
Row = Row --;<br />
txtAcctID.Text= dsPatDia.Tables["PatDia"].Rows[lastrecord]["Acct ID"].ToString(); <-- ERROR! <br />
}<br />
<br />
if( Row == 0)<br />
{<br />
try<br />
{<br />
oleDbConnection1.Open();<br />
<br />
oleDbDataAdapter1.SelectCommand.CommandText = "SELECT Results, Tests, Symptom FROM Dianosis WHERE [Acct ID]= '"+txtAcctID.Text+"'";<br />
<br />
oleDbDataAdapter1.SelectCommand.ExecuteNonQuery();<br />
<br />
oleDbDataAdapter1.Fill(dsDiag2);<br />
<br />
Display(dsDiag2);<br />
}<br />
catch (Exception ConnError)<br />
{<br />
MessageBox.Show(ConnError.ToString());<br />
}<br />
<br />
}<br />
<br />
}<br />
<br />
private void Display(System.Data.DataSet dsDiag2)<br />
{<br />
oleDbConnection1.Close();<br />
try<br />
{<br />
System.Data.DataTable PrevDiag = dsDiag2.Tables[0];<br />
<br />
if(PrevDiag.Rows.Count != 0)<br />
{ <br />
txtResults.Text = (string) PrevDiag.Rows[0][3];<br />
txtTests.Text = (string) PrevDiag.Rows[0][4];<br />
txtSymp.Text = (string) PrevDiag.Rows[0][5];<br />
}<br />
else<br />
{<br />
MessageBox.Show("The Patient Record does not exist","Information");<br />
dsDiag2.Clear();<br />
}<br />
}<br />
catch(Exception Error10)<br />
{<br />
MessageBox.Show(Error10.ToString());<br />
}<br />
}<br />
An unhandled exception of type 'System.NullReferenceException' occurred in CLINICINFORMATIONSYSTEM.exe
Additional information: Object reference not set to an instance of an object.
how do i rectify this prblem..i want the textbox to display the id of the record before the current one.?
CODER
|
|
|
|
|
There are at least two things you want to check out:
1. You probably forgot to fill the dataset before you call the methods (or even declared it as new).
2. The table does not exist, the column does not exist, or there are no records in the table.
How did you get the lastrecord variable in Rows[lastrecord] anyway?
Edbert P.
Sydney, Australia.
|
|
|
|
|
Hi ,
Find the exact line it occers. it says your object(may be oleDbConnection1 ) is still null, but your going to call its method.
D!shan
|
|
|
|
|
Hello,
most programms using a mdi container have a tabcontrol like panel showing all open windows for a fast switching. is there any avaible control for this, or dokumentation how to build such a feature?
thanks
|
|
|
|
|
Not provided in the FCL (.NET Framework Class Library), no. There are many third-party controls out there that do this, however, like .NET Magic Controls[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hey
i Got a Access data base file that i whant to open in C#, i use the folowing code
<br />
<br />
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=testdb.mdb");<br />
using(conn)<br />
{<br />
OleDbCommand com = new OleDbCommand("SELECT Medelande FROM Medelande",conn);<br />
using(com)<br />
{<br />
OleDbDataReader r = com.ExecuteReader();<br />
using(r)<br />
{<br />
this.txtBoard.Text = r["Medelande"].ToString();<br />
}<br />
}<br />
}
It says "ExecuteReader requires an open and available Connection. The connection's current state is Closed."
The file is in the projects dir and the file is named testdb.mdb .
Why is this not working? do i have to start a SQL Server? I have One SQL Server installed, but how do i get this server to know that i what to use this testdb.mdb?
And how do i rewrite the code so it takes contact with the SQL server instead?
//Jimmy
|
|
|
|
|
Hi...
Try using this:
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\mypath\\myDB.mdb");<br />
<br />
OleDbCommand com = new OleDbCommand("SELECT Medelande FROM Medelande",conn);<br />
<br />
conn.Open();
<br />
OleDbDataReader reader = com.ExecuteReader();<br />
...<br />
...<br />
<br />
conn.Close();
|
|
|
|
|
|
It workt well =)
But now i have an other problem
OleDbCommand com = new OleDbCommand("INSERT INTO Medelande" +<br />
"(id, Medelande) " +<br />
"VALUES (2,'kalle')", conn);<br />
int i = com.ExecuteNonQuery();<br />
this.txtMessage.Text = i.ToString();
It says that i need to use a qustion that can update?? what do the mean with that?
And if ID is i counter i could live it out right? it will get a value by the counter
//JImmy
|
|
|
|
|
If you have an AutoNumber as a field type, you shouldn't include it in your INSERT or UPDATE statements.
Also, don't use string formatting like that. Learn to use the OleDbParameter , which takes care of escaping all values for you and can perform type-checking (as far as databases go) on the client as opposed to submitting the query first to get an error back from the server. This is by far a better way and makes executing batch statements easier (since you create your statement and declare the parameters once, then just change the parameter values and execute the statement with each iteration). See the documentation for the OleDbParameter[^] class in the .NET Framework SDK for more information and examples.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi everyone,
I was hoping the following code would produce a DataGrid which sorts numbers as numbers (not as strings).
DataSet myDataSet = new DataSet();
myDataSet.ReadXml(fileName,XmlReadMode.Auto);
myDataSet.ReadXmlSchema("Data.xsd");
dataGridDaSData.DataSource = myDataSet;
But '10' is listed before '2'.
[fileName is passed;
Data.xsd was created by Visual Studio and corrected by me to require doubles;
Do I need the third line? - the xsd is listed in the XML...]
Any ideas?
---
|
|
|
|
|
If you've created an XML Schema in VS.NET, you should make sure that the IsDataSet option in the property grid (when the designer is open for the schema) is set to true. If you do this, you can generate a typed DataSet class which may resolve the situation (since all tables, rows, and fields are typed according to your typed DataSet schema.
Also note that a DataSet (and hence the DataGrid which has a view on the DataSet ) is not sorted by default (though, if your records were sorted to begin with, it may appear to be sorted). To sort, get the DataView from the table in question and set the Sort property according to the documentation. Use that view as the DataSource for your DataGrid . This is one way to solve the problem, so long as the DataSet recognizes the column as a number rather than a string. Again, using a typed DataSet should help solve the problem (and makes your code easier to write and faster since fewer lookups are required when you use the typed properties in your code).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
First off, thank you for your reply.
Secondly, sorry for such a late response.
Thirdly, my data comes from an XML file, so there is no DataView in use - will that affect my ability to sort it? Should I have a DTD inline within the XML?
Regards, J
---
|
|
|
|
|
I need to incorporate an unmanaged C++ dll into my C# application. I need to be able to create an object specified in the dll and call some methods on it. The documentation I have points me towards the System.Runtime.InteropServices namespace, but is not very clear. Can anyone tell me how to do this?
Thanks, G
|
|
|
|
|
i was struggling with that for a long time.
have a look here: http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20889520.html#10405890
a question of mine on EE
Hope it at least helps a bit.
---
|
|
|
|
|
If it is a COM dll then just simply add its refrenece from COM tab to your project,add its namespace and use it,if its not COM dll then search for DllImport in this site or MSDN or google and find lots of examples.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
See Interoperating with Unmanaged Code[^] in the .NET Famework SDK. There's section on exposing COM controls to your .NET application, exposing .NET controls as COM controls, and P/Invoking (consuming) native APIs from unmanaged DLLs. These are full of in-depth discussions as well as examples. Since it sounds like you're wanting to call native APIs, see the DllImportAttribute[^] documentation in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You can do one of the following:
1. Use Managed Extensions for C++ to make a managed adapter around your unmanaged C++ class and then use it from C# as any other managed type.
2. Make a C wrapper around your unmanaged class (explicit passing of *this , etc) and then use DllImport on the C# side.
I have tried both approaches: the second is usually easier, but it depends on your concrete situation.
|
|
|
|
|
hi all
i have an app built with directx 9.0 and have mesh in it
and i want to get out of using for example Alt+tab to go to another app and the get back to the directx app it tells me there is error called the sample does not exist wt can i do???
|
|
|
|
|
SherKar wrote:
...i want to get out of using for example Alt+tab to go to another app and the get back to the directx app it tells me there is error called the sample does not exist ...
A little clearer please... Are you saying that when you Alt-Tab to another app and then Alt-Tab back to your app, you get an error saying "The sample does not exist."? That isn't an error in any Microsoft documentation so I don't know where it is coming from. If it is a custom error being generated by your code, you'd have to go through your code to find out where it is coming from, because as of right now, there isn't enough information to determine what piece of code is causing the error.
RageInTheMachine9532
|
|
|
|