|
Hi,im bit new to .net and Now im stucked in this matter for few days!!
If Some one can help me,it will be great!!
What i want to do is,Im loading data to the left side listBox as follows
//Loading the AssistanceType
DataTable dtAssistanceType = ((MasterUI)this.ParentForm).ObjRemoteObject.VoTBL.GetAssistanceType();
ArrayList arAssis = new ArrayList();
arAssis.Add(dtAssistanceType);
lstTypeofAssistanceLeft.DataSource = dtAssistanceType;
lstTypeofAssistanceLeft.DisplayMember = "AssistanceType";
lstTypeofAssistanceLeft.ValueMember = "AssistanceTypeID";
Assistance[] ass = new Assistance[] { };
lstTypeofAssistanceRight.DataSource = ass;
lstTypeofAssistanceRight.DisplayMember = "AssistanceType";
lstTypeofAssistanceRight.ValueMember = "AssistanceTypeID";
And then ,when i press a button,i want to add the selected item to the right listBox and get the ValueMember (ID) of the selected value!!
I did it like this,
DataRowView dr = (DataRowView)lstTypeofAssistanceLeft.SelectedItem;
Assistance objAss = new Assistance();
//objAss.AssistanceTypeID =Convert.ToInt16(dr["AssistanceTypeID"].ToString());
//objAss.AssistanceType = dr["AssistanceType"].ToString();
lstTypeofAssistanceRight.Items.Add(lstTypeofAssistanceLeft.SelectedItem);
objAss.AssistanceTypeID = Convert.ToInt16(dr["AssistanceTypeID"].ToString());
objAss.AssistanceType = dr["AssistanceType"].ToString();
int id = Convert.ToInt16(lstTypeofAssistanceRight.SelectedValue);
But when i did like this,it doesn't give any ID!!!
But if i bind a data source to LeftlistBox,it wont allow me to add items!
If i didnt bind the dataSource it wont give the ID.
Anyone knows the solution for this???
Thanks alot!!!
|
|
|
|
|
I got the solution!!!
we can create a dataRowView object(objDV) and fill it with the selected item of the left list box!!and add the objDV to the rightListBox!!
So we can set the disply member and the value member!!
and get the ValueID!!
|
|
|
|
|
hello forum
i want to know the full form of CSV and what the full concept is
regards
rahul
|
|
|
|
|
|
That first link was very informative; thanks!
|
|
|
|
|
Glad to help you
|
|
|
|
|
Hi Rahul,
CSV is for Comma-separated values. CSV files are just like an excel. CSV is mainly use to import/export huge data in SQL. You can notice in some websites "Export to excel" link, if you click this link a file will be downloaded, which will be actually a CSV file (we use CSV due to its fastness and quick response).
Thanks
Be a good professional who shares programming secrets with others.
|
|
|
|
|
Mohammed Hameed wrote: CSV files are just like an excel
Well, no not really. A true Excel file (.xls) is not a csv file.
Mohammed Hameed wrote: "Export to excel" link, if you click this link a file will be downloaded, which will be actually a CSV file
Sometimes.
An Excel file is of a very specific format. A csv file is simply a comma delimited file which can be read by Excel or any number of other applications.
if you type bob,the,coder into notepad and save it you have a csv format file.
Hope this helps
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi,
I have create a deployment project in Visual Studio 2005. How do I set icon that displays in the Add/Remove program for my application?
Thanks
|
|
|
|
|
Select your Deployment Project > properties > AddRemoveProgramsIcon "the first item in the list"
Then browse for your icon "should be imported first"
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
i made 3 form . form1,form2,form3.
form2 is mdiContainer . when i open the form1 and form3 from form2..........
it opens , i want that when i click to open a new form it should check that wheather any form is opened
or not. if a form is already opened ,new form should not been opened.....
Maifs
|
|
|
|
|
If you want one and only one instance of a class then you need to hide the constructor and use a static method or property to return the single instance:
class foo
{
private static foo bar;
private foo()
{
}
public static foo barHandle()
{
if (bar == null)
{
bar = new foo();
}
return bar;
}
}
cake, piece of.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
If form1 and form3 are child forms, you can iterate through form2's MdiChildren to check before opening.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
Hi friends,
How can we do off/disable/suspend to the undo of the system
So that action and data would not go to undo stack.
e.i
If undo is off and user write some text in a notepad or delete any file.
Than user could not do undo,since it is not in undo stack.
Any type of help will be appreciated.
Thanks in advance.
Regards,
Khaleek Ahmad
|
|
|
|
|
how to change system time using c# code.please help
|
|
|
|
|
|
Hi all,
i have athe following Crc16 method. I want to use it in my C# application but am not sure how to go about it. Can anyone please put some light on this issue.
short int crc16(char *pBuf, short int Len, short int InitialCrc){
short unsigned int crc=0, i=0;
crc = 0;
for (i = 0; i < Len; i++ ) {
crc = (crc >> 8) | (crc << 8);
crc = crc ^ *pBuf;
crc = crc ^ ((crc & 0xff) >> 4);
crc = crc ^ (crc << 12);
crc = crc ^ ((crc & 0xff) << 5);
pBuf++;
}
return(crc);
}
Many thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
First you have to decide how you want to handle the characters. A character in C++ is 8 bits, while a character in C# is 16 bits.
After that, the translation is pretty straight forward.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
Programm3r wrote: The other problem is how can I convert string to char*
string foo = "Hello World";
fixed (char* fp = foo)
{
var i = crc16(fp, (ushort) foo.Length, 0);
}
|
|
|
|
|
|
Programm3r wrote: Would you say that the Crc method look good after my C# interpretation?
I am not sure that it is correct, as the result (which should fit in a 16 bit number) overflowed. I have modified it slighty, best would be to test the output with the output of the native function.
static unsafe ushort crc16(char* pBuf, int Len, ushort InitialCrc)
{
ushort crc = InitialCrc;
for (int i = 0; i < Len; i++)
{
crc = (ushort)((crc >> 8) | (crc << 8));
crc = (ushort)(crc ^ *pBuf);
crc = (ushort)(crc ^ ((crc & 0xff) >> 4));
crc = (ushort)(crc ^ (crc << 12));
crc = (ushort)(crc ^ ((crc & 0xff) << 5));
pBuf++;
}
return crc;
}
|
|
|
|
|
leppie, thank you very much. It looks perfect according to my previous results done in C++ ... five from me :
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
You have changed the type from ushort to uint, I'm not sure that works properly.
Do you really want to use unsafe code and pointers? Why not just use a string?
The InitialCrc value isn't used in the method at all, so you should remove it.
ushort crc16(string buffer) {
ushort crc = 0;
foreach (char c in buffer) {
crc = (crc >> 8) | (crc << 8);
crc ^= (ushort)c;
crc ^= (crc & 0xff) >> 4;
crc ^= crc << 12;
crc ^= (crc & 0xff) << 5;
}
return crc;
}
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
kindly let me know that, how may I correct the following problem?
* this connection string works good :
string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\BT.XLS;Extended Properties=""Excel 8.0;HDR=YES;""";
* but this does not work by using textBox1.text :
string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ textBox1.Text +";Extended Properties=""Excel 8.0;HDR=YES;""";
error is : "; expected"
Thank you in advance
(Riaz)
|
|
|
|