I have seen several postings on this error, but I can't seem to make the answers fit my problem.
Generally, it is a simple dgv load with a simple query. The error I get is:
Error: System.ArgumentOutOfRangeException: Index was out of range. Here is the code:
string sSQL =
"select * from...
I have loaded a comboBox with items from a query. It works well.
I need to add another item after loading from a query. It is an item that I don't want in the table.
Is this possible?
comboBox.ValueMember = "NetPK";
comboBox.DisplayMember = "NetName";
comboBox.DataSource = dt...
Just one more question and a clarification.
Clarification: How do I mark an answer as "Answered"? I don't see that option.
Question: If I want to ADD an option to my listbox, i could not bind it to my datatable (results of my query - my current approach). I assume I would need to run the...
That is a perfect answer! Worked great and makes sense. Thank you! and I appreciate the thought about the index access. That is indeed what I needed! Saved me posting back!
I am trying to pull the selected values from a listbox. Seems simple on the surface. There are several examples referring to the following:
foreach (var selecteditem in listBoxDocStatus.SelectedItems) {
Debug.WriteLine("Selected Item is: " +...
Hmmm... I think I just found it. The value that I am trying to set is null. My object (passedInCS.StatusFK) is null. So, it is bombing out of that and just displaying the form. I guess I am not accustomed to that behavior. I usually get some sort of an error saying it can't be set to null...
So, I write lots of fairly utilitarian routines for lots of things. Nothing fancy. Today, I ran into the weirdest problem. My code processes just fine down to a certain line, and then, even though the routine continues on, the code just stops like it is the end of the routine. I step thru...
I have 3, 1 to Many related tables. Let's say Customers to Orders and then Orders to Item Details. I have a window that displays all three. When I select a customer, I want the orders for that customer to all display and the active order to display all items.
When I select a different...
Trying to use the following code to pull a value from a datagridview cell:
private void dgvSQL_SelectionChanged(object sender, EventArgs e)
{
txtBoxMatchType.Text = dgvSQL.SelectedRows[0].Cells[0].Value.ToString();
}
The problem is that that loading the...
Trying to improve my coding skills by creating a picturebox with code. I can't get it to display on my form though. Seems pretty straightforward. Probably just missing a property?? I know my image has to be resized to fit, but that should be handled by the stretchImage property? Do i have to...
I have done StreamReaders using sr.ReadLine() for over 4 million records and it works fine. In this instance though, the lines have comma separated values with quote delimiters and I need to use them. So, I found a function that will split the lines and return a list. I have remarked out the...
I did further testing. It does not seem to be this block of code. It actually seems to be the array that is built to create the string sql statement. I commented the insert statement call and the memory still creeps up. I am building an array with all the values that go into the sql...
As my program steps through a dictionary and inserts records, my memory usage creeps up until I get a failure in my code. I am opening my connection to Oracle at the beginning and then just reuse the same connection during the entire process. So, calling the following code with a large insert...
So, followed this line of thinking a bit more and was able to use .Value. Had to convert to boolean to read it, but then it set just fine. So, resolved. Apparently, I just had to sleep on it!
My Datagridview displays fine with a check box column tacked on the end. I need to ACT on my checkbox click though. I am trying something like the following but it never hits the false section. All I get is true. I need allow the user to check the box (and then act on it), but block an...
I am reading a log file from another system to report errors more quickly with the following:
while ((sLine = reader.ReadLine()) != null)
{
//check result of each line and do something
}
Problem is that the system is failing log writes because i have the file locked. One option is to copy...
I split all the time on single characters. I needs to split on a combination of characters though. Like '~INS|'. I can't seem to make this work. Is this possible? In other words, split my line of text on every instance of these characters together.
Thanks,
Dave
I read a bunch of posts about this. Seems simple. I need to add the following folder if it does not exist.
H:\Health Plans\Enrollment\Name 834\2015\05 May\
The base will always exist (H:\Health Plans\Enrollment\Name 834\)
So, I am just doing the following...
Thanks! I was finally able to create a split function that worked. sSplitOnHL = sLine.Split(new[] { (char) 30 }); //Split on [RS] Control Code
I am still stumped on the replace though. I have tried sLine = sLine.Replace((char) 2, (char) 0 ); thinking that (char) 0 would replace with a null...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.