Forgot your password?
Sign in with
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View Python questions
View C++ questions
View Java questions
All Message Boards...
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Design and Architecture
Internet of Things
C / C++ / MFC
ATL / WTL / STL
Objective-C and Swift
Hardware & Devices
Hosting and Servers
.NET (Core and Framework)
Site Bugs / Suggestions
Spam and Abuse Watch
The Insider Newsletter
The Daily Build Newsletter
Most Valuable Professionals
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
What is 'CodeProject'?
Ask a Question
Bugs and Suggestions
Article Help Forum
Comments by ormonds (Top 32 by date)
Thank you. Now I get it.
Thank you. However I also have a number of other methods, each of which needs to update textBox1.text on form report.
Is it possible to make the form and its controls global?
Thank you, I'm sure you are right. I'll keep looking.
Yes, I did have it as one method, but when it failed split in (for now) into two methods.
There are no container controls on these tabpages so the method needn't be recursive.
I understand that the visual state won't change each step, but when I debug and watch the variable c.Enabled it changes when being set to false in the first method, but not when being set to true in the second method.
Thanks, yes, that was where I started but if I do that then the user can't select each tabpage and see the (disabled) controls. So I changed to simply disabling the controls on each tabpage so that at least they can be seen.
If the user clicks an "Edit" button they are enabled, or are meant to be.
Nope, added that and same result.
Thank you. That is what I am doing, but then when the comboBox is used it shows a list of blank items. Do I need to add a DisplayMember property to the comboBox and if so how do I do that? If not, any idea why the items aren't showing?
But if I am not using a DataSource for the comboBox, simply adding Items one by one in a foreach loop, then the DataSource is always null. I've tried Refreshing the comboBox, but the datalist is still blanks.
I assume that having added the comboBox item as per my code I have to add a value for that item's DisplayMember, but can't see how to select that item:
comboBoxProjects20. ?? . DisplayMember = temp1.
Thanks; yes, they are both true.
The method code is now:
private void comboBoxAdmin1_SelectedIndexChanged(object sender, EventArgs e)
Cursor.Current = Cursors.WaitCursor;
dataGridView1.AutoGenerateColumns = true;
bindingSource1.DataSource = null;
bindingSource1.DataSource = Variables.ProjexDS.Tables["People"];
bindingSource1.DataSource = Variables.ProjexDS.Tables["Jobs"];
bindingSource1.DataSource = Variables.ProjexDS.Tables["Companies"];
bindingSource1.DataSource = Variables.ProjexDS.Tables["EmployeeClasses"];
bindingSource1.DataSource = Variables.ProjexDS.Tables["ProfitCentres"];
bindingSource1.DataSource = Variables.ProjexDS.Tables["TimesheetActivities"];
bindingSource1.DataSource = Variables.ProjexDS.Tables["TimesheetGroups"];
bindingSource1.DataSource = Variables.ProjexDS.Tables["Activities"];
bindingSource1.DataSource = Variables.ProjexDS.Tables["MenuSecurity"];
Cursor.Current = Cursors.Default;
dataGridView1.DataSource = bindingSource1;
Cursor.Current = Cursors.Default;
dataGridView1.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2;
A typical table is populated so:-
private void populate_PeopleTable()
using (StreamWriter sw = File.AppendText("D:\\Projex.log"))
sw.WriteLine("Populating People Table");
using (SqlConnection con40 = new SqlConnection(WorkbenchConnection))
Variables.ProjexDA = new SqlDataAdapter();
LoadingState = "Setting up table People\r\n";
label26.Text += LoadingState;
Variables.ProjexDA.SelectCommand = new SqlCommand("SELECT * FROM People ORDER BY FullName", con40);
Variables.ProjexDA.MissingSchemaAction = MissingSchemaAction.AddWithKey;
Variables.PeopleTable = Variables.ProjexDS.Tables["People"];
Variables.PeopleTable.DefaultView.Sort = "FullName";
Variables.PeopleTable = Variables.PeopleTable.DefaultView.ToTable();
In debug mode I've checked the value of:-
dataGridView1.DataSource is System.Windows.Forms.BingdingSource
Varianles.ProjexDS.Tables["Activities"].DefaultViewAllow Edit is true
Variables.ProjexDS.Tables["Activities"].DefaultViewAllowNew is true
dataGridView1.Columns.IsReadOnly is false
dataGridView1.DataBindings.IsReadOnly is false
Variables.ProjexDS.Tables["Activities"].Rows.IsReadOnly is false
Variables.ProjexDS.Tables["Activities"].Columns.IsReadOnly is false
dataGridView1.EditMode is EditOnKeyStrokeOrF2
Thanks for your help; I think my next step is to create a new project with one DataTable and one dataGridView.
Tried all those suggestions. Helpful when populating a DataGridView but don't help my problem which is that I can't edit the DataGridView.
Thanks - that gives me a lot more detail about what to look for. I have tried your first suggestion and also the bindingsource solution but still can't edit the DataGridView.
Thank you - a closer look at the linked list showed errors in that.
Yes, I've been single stepping through it and it stops at the line
"if (tabControlPeople.Controls[CtrlName].Tag is null)"
I've looked through Solution Explorer and all control names are correct.
My suspicion is that a control on a tabcontrol on a panel on a form needs some explicit name which I can't figure out.
Yes, the TextBox is named textBox1000.
The answer is probably obvious and I've been staring at it too long - tomorrow will do.
Thank you very much for your help.
Yes, textBox1000 is in the LoadProcess form.
Projex.Variables class is static
LoadingState string is static
With a breakpoint on line 1 and "Step over Properties and Operators" unselected the line in public void SetStateMessage() "textBox1000.Text += ProJex.LoadingState;" gives the error "The name "textBox1000' does not exist in the current context."
I've tried renaming it to Loading.textBox1000.Text, same thing.
This suggests to me that the SetStateMessage is still in Form1.
I suspect I am missing something obvious, help appreciated.
Thank you, that is very helpful. I've worked through it, but in the LoadProcess class I get for InitialiseComponent "An object reference is required for the non static field...."
Also textBox1000 does not exist in the current context.
Found an answer, but probably uglier. I have added another (invisible) combobox which contains the CompanyID, matched that to the person's CompanyID and then set the SelectedIndex of comboBox3 to the same as the new comboBox.
Thanks for your help.
Thank you. I am now sure the the VPN is the problem so am troubleshooting that.
Thank you. Yes, I am now learning more about VPN set up.
I did increase it to 300, as shown in the code. That's five minutes, if that isn't long enough surely there must be some other problem?
Thanks for your suggestion, thatraja, but with respect the columns were added OK, just in a different way to your suggestion. The reason for the error was that I had a select statement referencing PersonID which I then referred to as StaffID. Anyway, all sorted.
No, all working now, Kelly had the answer. Thanks.
Thank you, Kelly, that's it. Appreciated. For some reason your answer hasn't turned up on the page.
..and yes, the app is for use by a small group of people in house, but I am reading up about SQL injection right now.
This seems to be just a different way of arriving setting up the DataTable. Certainly it gives the same result - no value for StaffID.
Thank you, yes, I have worked through that but it is silent on aspx code behind pages.
Thanks. Yes, the value of WE is correct, I have a temporary text box which displays the query. When I cut and past it into SQL it works fine.
I'll start looking at parameterised queries.
That worked, but not quite in the way I expected - it listed all objects on my personal machine including those shared folders I am a delegate on. I shall log another question about how to get all public folders and only them - I am Exchange Admin so it should be possible.
Thank you for your help.
Thank you, I will work through this today.
There are no subfolders, and the list in column A is correct, it was output to text from a Powershell command listing all folders.
Last Updated 1 Jan 1900
All Rights Reserved.