|
Hi all
i'm trying to check all items in a list view through a CheckAll checkbox option. now the problem is that when i click on the check all checkbox it gives me the NullReferenceException in the following code
private void AttributeList_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e)
{
attribute_list=attribute_list+"["+AttributeList.SelectedItem.ToString()+"],";
selected_columns.Add(AttributeList.SelectedItem.ToString());
}
the exception arises in the first line of the method
all i'm trying to do is save the checked items in the list view.
awaiting all replies
Saira
|
|
|
|
|
Hello,
Are you talking about System.Windows.Forms.ListView?
Cause I can not find a SelectedItem Property there (only SelectedItems which is an Array).
All the best,
Martin
|
|
|
|
|
yes , i 'm talking about System.Windows.Forms.CheckedListBox and there is a property SelectedItem.
does this help??
|
|
|
|
|
If I picture correctly what you doing, you looping through the listbox and setting the check.
This does not imply that thge item being checked is selected. hence the value of the selecteditem is null.
examine the selecteditems.count before using the code to see if it is not 0.
or set the
AttributeList.selecteditem = AttributeList.Items[loopcounter];
AttributeList.selecteditem.Checked = true;
but I am not sure if that will fire the event.
|
|
|
|
|
Why this one works
conn = new OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=dictdb.mdb;")
conn.Open()
da = new OleDb.OleDbDataAdapter("SELECT * FROM WordList", conn)
da.Fill(ds)
But this one doesn't work
conn = new OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=dictdb.mdb;")
conn.Open()
da = new OleDb.OleDbDataAdapter("SELECT * FROM WordList WHERE Src='test'", conn)
da.Fill(ds)
error I got is "No value gived for one or more required parameters"
|
|
|
|
|
Please paste your real code. The code you have posted here will not even compile.
Also, please tell us exactly which line the error occurred on.
|
|
|
|
|
What's the type of the Src column?
Does this statement work if you run it from Access' query editor?
|
|
|
|
|
Hi guys.
Anyone know the connection strings to connect C# application to Lotus Approach databases? (or id this is even possible?)
tnx.
-zoroyster
|
|
|
|
|
google for "NotesSQL301.exe" and use linked servers to get it working !
|
|
|
|
|
Hi all,
I have created windows service which inserts data on timer basis.
Right now am using dataconnections,queries in the windows service itself.
Instead i can call webservice to insert data.
I want to know whether which method works good.
1.using dataconnections in the windows service
or
Calling webserive for data insertion.
Plz give ur suggestions
Thanks in advance
cheers
sangeet
|
|
|
|
|
if performance is important and if you are never likely to want to use that dataaccess code elsewhere then keep it in the service.
If, however, the windows service is going to be one of many applications that will be using the data access layer and you want them all to use a consistent code base then use a webservice.
It can be a hard choice to make. I have used both in the past according to requirements. I've also wrapped the data code into a dll and used the dll in different projects.
No one solution will work for every case.
RUssell
|
|
|
|
|
Thanks for ur quick response.
In my case,am using the dataacces code only in the service and also performance matters.
I think its better to use the dataaccess code in the service itself.
Thank you.
cheers
sangeet
|
|
|
|
|
Hi, Dear(s)
How to set Cell Back Color in dataGridView of particular cell?
Thank you
|
|
|
|
|
Use GridView.Rows[i].Cells[j].BackColor=Color.someColor;
Regards,
Arun Kumar.A
|
|
|
|
|
Hi Dear Mr. Arun.
dataGridView1.Rows[intLooper].Cells[intLooperX].BackColor
the "BackColor" is not appearing after presing "Dot"
|
|
|
|
|
M Riaz Bashir wrote: dataGridView1.Rows[intLooper].Cells[intLooperX].BackColor
the "BackColor" is not appearing after presing "Dot"
Hey, that is strange.It is working in my code.
Any way, try this:
dataGridView1.Rows[intLooper].Cells[intLooperX].Style["background-color"] = "#cccccc";
Regards,
Arun Kumar.A
|
|
|
|
|
hi,
how to insert the item chosen from the combo box to a database table?
regards
jing
|
|
|
|
|
Obtain the selected text using Text Property of the DropDownList
in the Change Event.
Then update obtained text in the database.
Regards,
Arun Kumar.A
|
|
|
|
|
hi,
alright thanks, il try it...
regards
jing
|
|
|
|
|
Hi , guys!
I want to write a c# program to send windows message to other process.
For example,send a mouse click to IE.
Is this possible ? How?
Thanks!!!
|
|
|
|
|
Hi,
you will need P/Invoke to call some good old Win32 functions such as
SendMessage or PostMessage.
Lookt them up on CodeProject, Google or MSDN.
Also have a look at www.pinvoke.net
If pointers are required, they must be valid in the other process;
in that case you will also need VirtualAllocEx, VirtualFreeEx, WriteProcessMemory,
ReadProcessMemory.
|
|
|
|
|
I am getting System.OutOfMemoryExeception when executing this code:
...
StringBuilder afterSequence = new StringBuilder();
StringBuilder sequence = new StringBuilder();
StreamReader reader = new StreamReader(filePath);
string line;
bool sequenceReady = false;
while((line = reader.ReadLine()) != null && !line.StartsWith("CO"))
{
if(line.StartsWith("BQ"))
sequenceReady = true;
if(!sequenceReady)
sequence.Append(line + "\n");
else
afterSequence.Append(line + "\n");
}
...
I am reading 150MB file
Any ideas? And how can I read the file, because I need to send the whole file?
|
|
|
|
|
Hello,
Is the Exception accuring on the first time you are reading the file, or are you entering this code more often?
Just for info:
You should use the "new StreamReader" in a using block.
using(StreamReader reader = new StreamReader(filePath))
{
...
...
}//This makes sure that the Close() and/or the Dispose() method is called of the instance. (Can also have the effect of your Exception)
Using a StringBuilder is correct, so why doing this:
sequence.Append(line + "\n");
Instead of:
sequence.Append(line);
sequence.Append("\n"); //By the way, look at "Enviroment.NewLine"
Hope it helps!
All the best,
Martin
|
|
|
|
|
Hi,
seems like you are splitting a file into two parts, based on a line starting
with BQ. Now why would you use StringBuilder objects to do that ?
A StringBuilder is very efficient at collecting and possibly modifying text
content, particularly if it has sufficient capacity (otherwise internally a
new array has to be created and all data copied, everytime the capacity is
insufficient).
Depending on what you want to do with the two parts afterwards, I would
choose one of the following:
- create two files on disk; this avoids needing to have all data in memory at once;
- create two ArrayLists or List<string> in memory; this avoids the concatenation
of all text lines.
Even if you need each part as a StringBuilder, an ArrayList/List approach
allows you to determine the amount of data and create the StringBuilder object
with the right capacity, hence copying the data only once.
|
|
|
|
|
I have develop a Windows library ,i want to know how to make it into dll and how can i use this dll in other application in >net environment.
Plzz reply soon
|
|
|
|