|
To bind a value from DataGridView to textbox
when i am assigning it to a textbox like
txtcuscode.Text= dataGridView1.SelectedRows[0].Cells[0].Value;
shows an error message like this following..
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
the error is at this line...
txtcuscode.Text= Convert.ToString(dataGridView1.SelectedRows[0].Cells[0].Value);
the error handler points to the property text of the textbox...
help me overcome this..
plz help me recover this and thanks a lot for the code.....
SAJAN A PILLAI
C#.NET Programmer
TELESOFT INDIA PVT LTD...
BANGALORE
|
|
|
|
|
sajan ss wrote: txtcuscode.Text= dataGridView1.SelectedRows[0].Cells[0].Value;
well either the SelectedRows collection count is 0 or less probable Cells collection of first selected row count is 0.. so you should check like this:
if(dataGridView1.SelectedRows.Count>0)
txtcuscode.Text= dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
as for the binding itself..
txtcuscode.DataBindings.Add(new System.Windows.Forms.Binding("Text", source, "field_name", true));
where source is a BindingSource or a DataSet object..
life is study!!!
|
|
|
|
|
I instantiation an OCX Control, as follows:
AxZHFILEOCXLib.AxZhFileOcx fileOCXSend = new AxZHFILEOCXLib.AxZhFileOcx();
fileOCXSend.Tag = pfti;
fileOCXSend.bSender = true;
but "fileOCXSend.bSender = true" got an Exception. as follows:
“System.Windows.Forms.AxHost+InvalidActiveXStateException” Exception.
what is cause abuout it?
Thanks.
|
|
|
|
|
|
all the following is with respect to C#.Net
In remoting for better speed we opt for TCP channel.
why is TCP is faster than HTTP.
|
|
|
|
|
If you use Socket you get more speed.
Manoj
Never Gives up
|
|
|
|
|
socket or remoting whichever be the case,but why is that TCP faster than HTTP
|
|
|
|
|
When sending over TCP you don't have to do much other than serialize the objects and chuck them over the connection.
Using HTTP you have to use the HTTP protocol which takes more time and bandwidth.
You also have the choice of the Binary Serialization and SOAP serialization. Binary makes the smallest output but SOAP is better for interop with other system or if you need the output to be human redable.
In the end you need to choose which is the right combination for you based on what you need. If you need built in security and authentication then HTTP remoting via IIS is best, it also works well with firewalls. If your just working on an intranet or you really need the performance TCP will be fine.
|
|
|
|
|
Depending if you are on the local machine, you can even use IPC, which is alot faster than TCP or HTTP.
|
|
|
|
|
Hi all
does anyone have a working example (2.0) of how to use the registerhotkey API for c#
i am trying to run an event even if the window is not in focus and I have seen a few crapy vb.net examples that i can get to compile
I was wondering if there was a C# example floating around since thats what i prefer to program in anyway.
(also yes I am google-ing as we speak im just useing the forums as a backup)
Thanks
|
|
|
|
|
Did you search codeproject? It has several articles about it
|
|
|
|
|
which one
C# Programming
Beginners
Skype smiley sender
Last Updated: 24 May 2007 Page views: 1,388 Rating: 3.2/5 Votes: 13 Popularity: 3.6
An article on sending many smileys simultaneously with Skype
Unedited Reader Contributions
Convert mp3 to exe
Last Updated: 4 Jun 2007 Page views: 9,691 Rating: 4.4/5 Votes: 34 Popularity: 6.8
An article showing how to convert mp3 file to executable file
Rename Start Button
Last Updated: 1 Jun 2007 Page views: 4,149 Rating: 4.6/5 Votes: 27 Popularity: 6.6
An article describing how to rename start button programmatically
|
|
|
|
|
I didn't mean my articles, I meant codeproject. Search for registerhotkey Api and you will find an example
|
|
|
|
|
Hi,
How do you copy a picture box during run-time??
ps. I'm intending to make a copy of it and put it in the same form/panal during run time;
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
|
|
this should to the trick..
Image copyImg = new Bitmap(pictureBox.Image);
life is study!!!
|
|
|
|
|
Thank you Seishin
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
the following code is in C#
I have 2 interfaces
public interface Interface1
{
string ReturnString1();
}
public interface Interface2
{
string ReturnString1();
}
now i implement both the interfaces in a single class
Class A:Interface1,Interface2
{
}
now according to my searchings i found that we can implement both the interfaces in the following manner
Class A:Interface1,Interface2
{
public string Interface1.ReturnString1()
{
return "Interface1.ReturnString1";
}
public string Interface2.ReturnString1()
{
return "Interface2.ReturnString1";
}
}
but on compiling it is giving an error:"the modifier public is not valid for this item"
after i remove public and then i compile the code, it compiles successfully
but i'm not able to access these methods by creating an object of the class.
Can anyone solve this problem
Amit More (CMC)
-- modified at 3:01 Wednesday 6th June, 2007
Amit More (CMC)
|
|
|
|
|
amitcoder83 wrote: string ReturnString1();
the default access for any method or property is private. If you remove 'public' then they default to private right through your code.
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 )
|
|
|
|
|
I think you are not correct
Manoj
Never Gives up
|
|
|
|
|
Manoj Kumar Rai wrote: I think you are not correct
You could atleast provide an explination rather than going round insulting people.
If you explain why then people will be thankful of learning something new rather than thinking your an arse
|
|
|
|
|
|
Its correct that modifier public is not valid for those function.
Also pls make sure you are accessing those function from a object type of Interface1 or Interface2 and not from a object of the class A directly, to get the access to those function.
i.e.
Interface1 interface1 = new A();
interface1.ReturnString1(); //Here you will be able to access the function.
Manoj
Never Gives up
|
|
|
|
|
All the code is in C#,
so if i dont specify access modifier then by default it is public
after implementing the methods in an interface we can access the methods thru that class's object.why can't we do the same with this.
Amit More(CMC)
-- modified at 3:10 Wednesday 6th June, 2007
|
|
|
|