|
chkListBox.SelectedIndex = index;
chkListBox.SetItemCheckState(index, CheckState. ...);
|
|
|
|
|
Dear All,
I am developing a desktop application in C#. My client right now is using
Excel to create their data sheet. In excel we can use drag and drop functionlity
(Entering data in one row and pasting it by dragging to multiple rows). I want
to implement same functionality in DataGridView. Any clue to do this.
Any help will be appreciated.
Regards,
Lalit Ahuja
|
|
|
|
|
hi
it is my Code :
DataTable dt = new DataTable();foreach (DataGridViewRow _gridViewRow in dataGridView1.Rows)
{
if (_gridViewRow.Cells[0].Value != null && _gridViewRow.Cells[0].Value.ToString() == "True")
dt.ImportRow(ds_zamin1.Khaneh_1.Rows[_gridViewRow.Index]);
}
this.dataGridView1.DataSource = dt; // dt is global viriable
but when i execute this method,nothing occured,only myDatagridView show some blank row(s).
how to solve problem ?
|
|
|
|
|
Someone recently asked exactly the same question... I think on the next page...
Read the forum and search for your item before posting a new question...
- - - --[ i love it when a plan comes together ]-- - - -
|
|
|
|
|
Hi,
I need to pass additional info about created component from Addin to form designer. I have written custom service MyService which implements IMyService interface. I add this service by AddService method of active window's DesignerHost object. When i try to retrive it from form's desigher class,
IMyService ms = (IMyService)GetService(typeof(IMyService))) ,
it makes an error like "Cannot cast objet of type MyService to IMyService"
Thanks for help
|
|
|
|
|
hi,
in my application i have a listview with populated data. when i select a row i get my results but as soon as i want to select any other row i get the following error:
InvalidArgument=Value of '0' is not valid for 'index'.
Parameter name: index
here is my code:
<br />
private void listviewAcc_SelectedIndexChanged(object sender, EventArgs e)<br />
{<br />
_DataValues.AccountName = listviewAcc.SelectedItems[0].Text.ToString();<br />
}<br />
no matter what i change the index to it will give me the same error. this only works the first time i selected a record but as soon as i make a second selection i get this error
pls help
thanks
regards
|
|
|
|
|
I had this problem too. When I debugged it, I noticed that it was calling my event handler twice if I changed from one selected item to another, but only once if I had nothing selected and I clicked one. This makes sense because when the selection changes from one item to another, it has to deselect the current item, which fires the 'Changed' event, and then it selects the new item, firing the event again.
The first time the event gets called, there is no selection (SelectedItems has a size of 0), so you will get an InvalidArgument or possibly the "Object reference not set to an instance of an object" error. All you need to do is add a check to see if any items are selected. You can do that by examining the Count property of SelectedItems.
"Quality Software since 1983!" http://www.smoothjazzy.com/ - see the "Programming" section for (freeware) JazzySiteMaps, a simple application to generate .Net and Google-style sitemaps!
|
|
|
|
|
Hello,
I'd like to run an application in a remote computer, but without client/server structure, for example using the class Process in the remote computer.
Thanks
|
|
|
|
|
You and every virus writer on the planet.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hello,
Can any body provide me with custom explorer sample project just like the one used by windows... want to have that to save some time...
Thanks.
Regards.
|
|
|
|
|
I put "C# custom explorer sample project" into Google and found this:
http://www.codeproject.com/useritems/ExplorerTree.asp[^]
Usually when you do your Google queries for this kind of thing, if you put the language or technology you want to use, it will come back with pretty good responses. This was the third result, and I think it should answer your question.
"Quality Software since 1983!" http://www.smoothjazzy.com/ - see the "Programming" section for (freeware) JazzySiteMaps, a simple application to generate .Net and Google-style sitemaps!
|
|
|
|
|
Here's another one: C# File Browser[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi sir,
I wrote a app.config as follows
<appsettings>
<add name="dbConnection"
="" connectionstring="data source=MANGALA;initial catalog=Northwind;persist security info=False;user id=sa;pwd=sa;workstation id=MANGALA;packet size=4096" providername="System.Data.SqlClient">
I called that connection string like this,
SqlConnection cn;
sConn = System.Configuration.ConfigurationManager.AppSettings("dbconnection");
cn = new SqlConnection(sConn);
cn.Open();
then it is an error :
The type or namespace name 'ConfigurationManager' does not exist in the class or namespace 'System.Configuration' (are you missing an assembly reference?)
I am a beginner for c# can you help me?
thank you
|
|
|
|
|
Collapse your project in the Solution Explorer window and right click 'References' and choose 'Add Reference'.
A popup window appears, on the .NET tab, choose System.Configuration and press the OK button.
Try rebuilding your project
- - - --[ i love it when a plan comes together ]-- - - -
|
|
|
|
|
Hi
I tried that, but there is no just System.Configuration. it has System.Configuration.install.dll I add that. but same error is coming.
thanks
|
|
|
|
|
That means you already added it, and you just need the Using statement I mentioned.
"Quality Software since 1983!" http://www.smoothjazzy.com/ - see the "Programming" section for (freeware) JazzySiteMaps, a simple application to generate .Net and Google-style sitemaps!
|
|
|
|
|
mwith wrote: Hi sirs and madams,
(fixed that for ya)
You need to have:
using System.Configuration;
at the top of your code file. You might also need to explicitly add the reference to the System.Configuration assembly to your project. (Right-click on 'References' in the solution explorer, and click 'Add Reference...', then select the System.Configuration assembly, which is under the .Net tab in the window that pops up, and add that assembly to your project.)
You will need to add a name attribute to your config file entry, or the app can't tell what you mean by 'dbconnection'. I do it like this:
<appSettings>
<add key="dbconnection" value="myconnectionstringwhateveritis"/>
</appSettings>
Also, I hope you didn't just give us all your SA login info. You need to change that right away if you did.
"Quality Software since 1983!" http://www.smoothjazzy.com/ - see the "Programming" section for (freeware) JazzySiteMaps, a simple application to generate .Net and Google-style sitemaps!
|
|
|
|
|
With a password like that he'd want to change it even if he hadn't posted it on the internet. I'm assuming that he's changed it to sa like i would change mine to pwd if posting stuff on a forum.
Reminds me of a place i worked where the head of IT was one of the owners of the company. While searching for some info about recordsets on usenet i saw a post of his from 5 years before. I duly went to have a look and found a username and password URL and port in his example code. I then discovered that not only had he not changed the password for this account but it was on a server that was still exposed to the internet and had domain admin permissions on our internal network. When i asked him about it, he said "That account, oh we haven't used it for ages, why do you ask".
sorry for the OT,
Russ
|
|
|
|
|
That's not really true, it would be neat though, but as you can see in his code, het uses the entire namespace in his code :
System.Configuration.ConfigurationManager.AppSettings["name"]
which does not require a 'using' statement, but again... it would be neat...
- - - --[ i love it when a plan comes together ]-- - - -
|
|
|
|
|
Yeah you're right... I totally missed that.
I think he's using .Net 1.1, but I can't remember what the difference was. With a .Net 2.0 project, it should be working if the assembly is added like he said.
"Quality Software since 1983!" http://www.smoothjazzy.com/ - see the "Programming" section for (freeware) JazzySiteMaps, a simple application to generate .Net and Google-style sitemaps!
|
|
|
|
|
Erhm, you don't have the configurationmanager object there...
The .NET 1.1 ols fashion way is
System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]
(or ofcourse)
using System.Configuration;
and
ConfigurationSettings.AppSettings["ConnectionString"]
- - - --[ i love it when a plan comes together ]-- - - -
|
|
|
|
|
What version of visual studio / .NET Framework are you using. The code you have will only work in .NET 2.0 (Visual Studio 2005).
Also, replace the () with [] after AppSettings because once you've fixed this error your going to get another.
|
|
|
|
|
|
(I was typing my reply when your old post disappeared! I figured it had been moved, but I had some trouble finding it. Anyway, here's what I was trying to say before.)
You're thinking a little old-skool there. I think if you take advantage of the .Net Framework, you can eliminate the middle-tier and still keep things secure. You don't want to get into COM-hell, which is not entirely eliminated with .Net assemblies. The Windows client and the SQL database are enough. Keep it simple. If you are going to store your information in a database, you won't need to serialise your objects... that's really only useful if you're using files for storage or if you really need a middle-tier. To store an object all you need is to put the current values of the member variables into columns in your database. So if you had an object like this:
class myObject {
int myNumber;
string myString;
...some functions and such...
}
You would simply create a database table like this:
create table myObject (
object_id int,
myNumber int,
myString varchar(x)
)
You need an object ID so you can make sure you don't get multiple instances mixed up. You could use any property of the object to make it unique - doesn't have to be an integer.
Then you create a stored procedure to store this object data (and perhaps send back a new unique ID), and another stored procedure to retrieve objects based on their ID. You will be able to use these stored procedures in a secure fashion from the client, and you will be able to take advantage of all kinds of cool security features designed for this exact purpose, and all your validation can be performed on either of (or both of) the two layers. As long as you're not doing super-complex math or predicting the weather or something, you should be able to push all the validation down to the database layer. That is the way to go if you suspect multiple versions of the client, but if you have total control over client updates, then you are safe doing that stuff on the client and avoiding a round trip to some server somewhere. I've just finished a very complex application that uses this model - there was no reason for a middle tier. You haven't given any reason why you really need that.
"Quality Software since 1983!" http://www.smoothjazzy.com/ - see the "Programming" section for (freeware) JazzySiteMaps, a simple application to generate .Net and Google-style sitemaps!
|
|
|
|
|