|
Okay. I traced through the previously posted code and the data is actually being inserted into the table correctly and at the correct position. It is the DefaultView which is causing the list to display in the wrong order.
I added the following to the method:
CurrencyManager cmSelect = (CurrencyManager)this.lstSelected.BindingContext(dtSelect);<br />
cmSelect.Refresh();
It runs without error, but nothing changes. Can anyone suggest another approach?
|
|
|
|
|
Then create a DataView on the table and set that as the DataSource .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm Developing a WebApplication in which i have to pass parameter to DLL present in a remote computer and return the values returned by the DLL to the user... someone please help me in doing this....
|
|
|
|
|
You can't load a DLL from a remote computer and have it executed on the remote computer. You need some sort of RPC (remote procedure call), such as DCOM, COM+, .NET Remoting (preferred in .NET applications), or Web Services (if the other machine has IIS installed). In those cases you could P/Invoke the exported function from that DLL (if it's native), thus wrapping the unmanaged function in a managed class (or a native DCOM or COM+ executable).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I was thinking of combining a Diffgram Dataset with using Web Services. From my readings I noticed that I can save a dataset as a diffgram to a file after I do updates/inserts/deletes on the dataset. Then when I need to do more updates/inserts I reread the diffgram into a dataset and if I am connected to a database then use a dataadapter to update the database with changes. Is this correct in my assumption of how I can use the diffgram? I would create a Web Service to accept the Diffgram Dataset and have it create a DataAdapter to update the database. How does this sound? Any ideas?
Thanks,
JJ
|
|
|
|
|
You could do this with a diffgram, but the DataSet and DataAdapter derivatives already support changes. Lets say that your client made changes to a DataSet it original got from a web service. To send the changes call DataSet.GetChanges to get just the changes (optionally, but decreases bandwidth consumption) and then pass the DataSet back to the web service. The web service could call DataAdapter.Update on the DataSet and optionally return the DataSet back to the client (in case there were changes made by other clients, etc.
Just be sure you don't call AcceptChanges otherwise all change information is lost. DataAdapter.Update does this automatically after updating the database. The DataAdapter should have all four command properties defined, and it's common to combine an INSERT and SELECT statement (separated by a semi-colon (;)) so that any auto-generated information (or default values) are included in the DataSet .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath,
Ok, but this is for an alternative to my semi Offline connection problem. So I would try to contact a web service sitting on the server and if it can't make a connection then have the dataset write out to a diffgram xml file. If I can make a connection then send Diffgram dataset to web service to update database by using DataAdapter in web service. How does that sound, Heath?
Thanks,
JJ
|
|
|
|
|
Fine, but why write-out the diffgram at all, unless you're worried about your application being closed. That's understandable.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ok, I'm not worried about the App being closed. But if connection can't be made to web service on server where do I store the dataset once data is entered in app? I assume just use a normal dataset if not going with diffgram to store locally? Also if I did use a diffgram dataset, this would be the same as replication to database on server. The web service dataadapter would check changes and only pass the inserts/updates etc. to db.
JJ
|
|
|
|
|
Just keep it in memory as an object and keep adding/updating/deleting rows. Once a connection can be established, then send the diffgram (remember, don't ever call AcceptChanges or you won't have a diffgram! ). If you want to save this in case the application is closed, make sure you write out the diffgram using XmlWriteMode.DiffGram and read it back in later.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Ok now I got what you are saying. Yes the application will be closed once done entering in info. This is done on a daily basis and having the PDA on all day doesn't make sense.
Thanks Heath,
JJ
|
|
|
|
|
Note, just because a PDA appears off doesn't mean the memory state isn't saved. This is how they work - unless you physically turn off the device, it is always on - it is just sleeping or hibernating. When you turn it on, every program is still running as it was before. How do you think they can notify you of events when they appear off?
Also, even when you close an application using the X button at the top, the application is still running (unless you're using a single process build of Windows CE - but PocketPC is a multi-process build). It isn't terminated unless you use the Memory control panel app to terminate it or your program terminates itself (or has a critical error and dies).
A few things to keep in mind.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello all,
My requirement:: There's protocol Interface class with some persistant data which has to be invoked from seveal other classes with out disturbing the Member data. In Visual C++ windows application we create new instance of Protocol Class in the Application main class.... & gets reference of this where ever we are using it.... like
CProtocolAPI *pProtocol = (TestApp*)AfxGetApp()->m_pProtocol
and we can call methods of CProtocolAPI using pProtocol reference
now my doubt is how can i do this in C#.... can any body give me some idea..... little urgent plzzzzzzzzz
Thanku in advance
Adi
|
|
|
|
|
Store a static instance of ProtocolInterface inside your main class and create a static property to access it.
<br />
public class Main<br />
{<br />
private static ProtocolInterface protocol;<br />
public static ProtocolInterface Protocol<br />
{<br />
get<br />
{<br />
return Main.protocol;<br />
}<br />
}<br />
}<br />
Access the instance by Main.Protocol
Does this help?
|
|
|
|
|
I have three forms a parent form, child form 1, child form2. Child form1 is a user interface used to save data to the random access file .The user inputs the following in to the textboxes Name, Account Number, & Address. Child form2 reads the file. That works fine but I would like to use a combobox to display the name and account number, so when the user selects the name & account nuber the textboxes are filled with the appropriate data. Is this possible? Any help would be greatly appreciated.
|
|
|
|
|
my way:
public dataset owned by parentform, with all the data you need in both childs. So even if user changes data from 1st child, data in the 2nd one are immediately available. That's a little faster: no need to save/read/synchronize two datasources. And no need to write your own save to file/load/parse etc. stuff.
h.
|
|
|
|
|
I am importing data from a excel sheet to a listview box. I need to set the range of the listview column to the no of columns available in the excel sheet.
I am able to count the available no of columns in the excel sheet using worksheet.columns.count.
The worksheet.get_range(object cell1, object cell2) asks for the the starting column ie A to the end column which could be anything from B to ZZ and so on.
The solution I could see is add the worksheet.column.count value to 65(ascii code of A). But how do i convert back the value say 77 to its equivalent Ascii char M. I dont find any toascii() function.
Regards
Tarakeshwar
CCIE Q(Routing and Switching), MCSE Security
|
|
|
|
|
You can cast from an int to a char and back again. You don't need any such toascii function.
IIRC, you can just use the string references for the Range object. You could then just enumerate through the collection returned and put the cell values in the ListView according to their index in the collection.
Finally, I'm not sure about your implementation, but have you consider just embedded the Excel ActiveX control in your application?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have created a tree and need to add nodes to it, around 28,000 of it. I get the data from the sql database and using dr check for the four different types. According to the type I display the first type first with a color, then the next type with a diff color and so on for the four types of data. The time it takes to load the tree is around 12 secs, but I cant afford more than 5 secs for the task. I have used Treeview.BeginUpdate and Treeview.Endupdate in the code.
Is there any other method to make sure that the tree listing takes place even faster.
Regards
Tarakeshwar
CCIE Q(Routing and Switching), MCSE Security
|
|
|
|
|
Calling BeginUpdate and EndUpdate is about the only thing you can do if you want to load all nodes at the same time. Even using threading, you'll have to use TreeView.Invoke (inheritted from Control ) to add the TreeNode in the thread on which the TreeView was created (necessary, or you'll get strange problems if it even works at all). This still means that adding the tree nodes is synchronous, although initializing the tree nodes can happen in a separate thread (though this probably won't give you the 7 seconds you need).
If you don't need to load the entire tree, I recommend handling the TreeView.BeforeExpand event to implement an on-demand tree.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I agree that TreeView.BeforeExpand is the best solution. Loading 28,000 nodes will take a long time.
Have you tried timing your method to see if it takes 12 seconds for the tree to populate or to reterieve the data from database?
If it's tree loading, you can just load all the data, keep it in some data structure and populate tree with BeforeExpand.
|
|
|
|
|
hai,
i have two custom controls in my application. I need one more custom control with some controls. The fact is what ever control i need is already in that two custom control. Is it possible to inherit the control class which avilable in above two custom controls into the third control. If yes. How i can do that ?
hai, feel free to contact
Sreejith SS Nair
|
|
|
|
|
You can extend your custom control just like your custom controls extend whatever control (presumably the UserControl class). As far as including controls instantiate in the other custom controls, no. Those are just instances. You'll have to include instances of the same control classes in yours.
What you are asking is hard to understand, though. Could you elaborate a little more?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi there, fellas!
The question I am asking has perhaps been asked here, anyway, why are you C# programmers so often snobbish to us VB.NET programmers? I've encountered that so many times and it really seems a patterned behavior.
IMHO, that comes from the opinion that VB.NET is the descendant from VB6, which many of you don't regard as a "serious" programming language. I completed a bunch of business projects in VB6 which make use of COM, DCOM, TCP/IP, serial comms in the past, and I am sure that I made it way much faster than if somebody using C++.
Now I am programming for .NET in VB.NET, mainly business applications, both ASP.NET and Forms. In my projects I use n-tier paradigm, Remoting, Reflection, multi-threaded programming, dynamic code generation, etc. It takes much less time to use VB.NET than C#. Why the heck do I need to recompile my project every time I add a new method or property for it to show up in Intellisense?
Having both linguistic and technical education, I can say that it is really more clear to use AddHandler than to use "+=".
As a conclusion I want to say that VB.NET is at least as powerful as C# when it comes to business applications. Can you prove I am wrong?
Regards,
Serge (Logic Software)
|
|
|
|
|
Because logical syntax rules () and {} and "END LOOP" is whack.
Just kidding but I love my C influenced syntax, and find other forms of syntax lacking or silly. And VB will never live down it's pre .Net bad image, like it or not.
Anybody that claims one language is better than another within .Net does not understand how .Net works or what it really is. All languages are equal, it's just syntaxical sugar on what language you choose.
|
|
|
|