15,669,580 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View Python questions
View Javascript questions
View C++ questions
View Java questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by ormonds (Top 32 by date)
ormonds
7-Mar-22 7:50am
View
Thank you. Now I get it.
ormonds
7-Mar-22 2:32am
View
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?
ormonds
19-Jan-22 22:55pm
View
Thank you, I'm sure you are right. I'll keep looking.
ormonds
19-Jan-22 21:07pm
View
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.
ormonds
19-Jan-22 21:02pm
View
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.
ormonds
19-Jan-22 18:07pm
View
Nope, added that and same result.
ormonds
13-Jan-22 15:59pm
View
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?
ormonds
13-Jan-22 2:50am
View
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.
ormonds
2-Jan-22 16:07pm
View
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;
dataGridView1.Columns.Clear();
bindingSource1.DataSource = null;
Refresh();
switch (comboBoxAdmin1.Text)
{
case "People":
bindingSource1.DataSource = Variables.ProjexDS.Tables["People"];
break;
case "Jobs":
bindingSource1.DataSource = Variables.ProjexDS.Tables["Jobs"];
break;
case "Companies":
bindingSource1.DataSource = Variables.ProjexDS.Tables["Companies"];
break;
case "EmployeeClasses":
bindingSource1.DataSource = Variables.ProjexDS.Tables["EmployeeClasses"];
break;
case "ProfitCentres":
bindingSource1.DataSource = Variables.ProjexDS.Tables["ProfitCentres"];
break;
case "TimesheetActivities":
bindingSource1.DataSource = Variables.ProjexDS.Tables["TimesheetActivities"];
break;
case "TimesheetGroups":
bindingSource1.DataSource = Variables.ProjexDS.Tables["TimesheetGroups"];
break;
case "Activities":
bindingSource1.DataSource = Variables.ProjexDS.Tables["Activities"];
break;
case "MenuSecurity":
bindingSource1.DataSource = Variables.ProjexDS.Tables["MenuSecurity"];
break;
default:
Cursor.Current = Cursors.Default;
return;
}
dataGridView1.DataSource = bindingSource1;
dataGridView1.Refresh();
Cursor.Current = Cursors.Default;
dataGridView1.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2;
Refresh();
}
A typical table is populated so:-
private void populate_PeopleTable()
{
using (StreamWriter sw = File.AppendText("D:\\Projex.log"))
{
sw.WriteLine("Populating People Table");
sw.Close();
}
using (SqlConnection con40 = new SqlConnection(WorkbenchConnection))
{
con40.Open();
Variables.ProjexDA = new SqlDataAdapter();
LoadingState = "Setting up table People\r\n";
label26.Text += LoadingState;
Refresh();
Variables.ProjexDA.SelectCommand = new SqlCommand("SELECT * FROM People ORDER BY FullName", con40);
Variables.ProjexDA.MissingSchemaAction = MissingSchemaAction.AddWithKey;
Variables.ProjexDA.Fill(Variables.ProjexDS, "People");
Variables.PeopleTable = Variables.ProjexDS.Tables["People"];
Variables.PeopleTable.DefaultView.Sort = "FullName";
Variables.PeopleTable = Variables.PeopleTable.DefaultView.ToTable();
con40.Close();
}
}
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.Enabled=true
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.
ormonds
1-Jan-22 3:11am
View
Tried all those suggestions. Helpful when populating a DataGridView but don't help my problem which is that I can't edit the DataGridView.
ormonds
30-Dec-21 0:10am
View
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.
ormonds
19-Dec-21 17:59pm
View
Thank you - a closer look at the linked list showed errors in that.
ormonds
14-Nov-21 23:01pm
View
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.
ormonds
16-Oct-21 23:14pm
View
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.
ormonds
16-Oct-21 21:17pm
View
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.
ormonds
16-Oct-21 18:15pm
View
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.
ormonds
11-Oct-21 20:55pm
View
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.
ormonds
10-Aug-21 22:34pm
View
Thank you. I am now sure the the VPN is the problem so am troubleshooting that.
ormonds
6-Aug-21 18:54pm
View
Thank you. Yes, I am now learning more about VPN set up.
ormonds
4-Aug-21 21:30pm
View
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?
ormonds
3-Feb-21 4:17am
View
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.
ormonds
3-Feb-21 0:34am
View
No, all working now, Kelly had the answer. Thanks.
ormonds
2-Feb-21 18:34pm
View
Thank you, Kelly, that's it. Appreciated. For some reason your answer hasn't turned up on the page.
ormonds
2-Feb-21 17:10pm
View
..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.
ormonds
2-Feb-21 16:35pm
View
This seems to be just a different way of arriving setting up the DataTable. Certainly it gives the same result - no value for StaffID.
ormonds
15-Nov-20 2:54am
View
Thank you.
ormonds
29-Oct-20 16:47pm
View
Thank you, yes, I have worked through that but it is silent on aspx code behind pages.
ormonds
29-Oct-20 3:06am
View
It's a work related job reporting and managing web site which uses a SQL database. I'm happy with writing c# win apps and with simple asp web sites, generally using VS, but I now need to learn how to use javascript in aspx pages, with Masterpages.
ormonds
27-Oct-20 18:20pm
View
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.
ormonds
11-Nov-19 16:07pm
View
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.
ormonds
11-Nov-19 15:40pm
View
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.
ormonds
21-Jun-18 4:53am
View
Thank you!
Show More