i am loading more than 50000 Records in Rad grid win forms. how to optimize and makes the grid to loads fast (instant)?. is there option to load pagewise filter in telerik rad grid columns filter?.
Me.cncFilesGridRad.MasterTemplate.AllowAddNewRow = False
Me.cncFilesGridRad.MasterTemplate.AllowDeleteRow = False
Me.cncFilesGridRad.MasterTemplate.ShowRowHeaderColumn = False
Me.cncFilesGridRad.MasterTemplate.ShowHeaderCellButtons = False
Me.cncFilesGridRad.UseScrollbarsInHierarchy = True
Me.cncFilesGridRad.ShowGroupPanel = False
Me.cncFilesGridRad.HorizontalScroll.Enabled = True
Me.cncFilesGridRad.MasterTemplate.EnableSorting = True
Me.cncFilesGridRad.MasterTemplate.EnableGrouping = False
Me.cncFilesGridRad.EnableFiltering = True
Me.cncFilesGridRad.ShowHeaderCellButtons = True
Me.cncFilesGridRad.MasterTemplate.EnableFiltering = True
Me.cncFilesGridRad.ShowFilteringRow = False
Me.cncFilesGridRad.MasterTemplate.ShowFilterCellOperatorText = False
Me.cncFilesGridRad.MasterTemplate.AllowCellContextMenu = False
Me.cncFilesGridRad.EnableFastScrolling = True
Me.cncFilesGridRad.BeginUpdate()
Me.cncFilesGridRad.DataSource = GlobalVariables.CNCFilesCollection
Me.cncFilesGridRad.AutoSizeRows = True
Me.cncFilesGridRad.TableElement.RowHeight = 60
Me.cncFilesGridRad.TableElement.FilterRowHeight = 40
Me.cncFilesGridRad.GridViewElement.PagingPanelElement.NumericButtonsCount = 25
Me.cncFilesGridRad.VirtualMode = True
AddTemplateToGrid()
Me.cncFilesGridRad.MasterTemplate.Templates(0).AllowAddNewRow = False
Me.cncFilesGridRad.MasterTemplate.Templates(0).AllowDeleteRow = False
Me.cncFilesGridRad.MasterTemplate.Templates(0).AllowEditRow = False
For Each col As GridViewDataColumn In Me.cncFilesGridRad.Columns
col.IsVisible = False
Next
For Each col As GridViewDataColumn In Me.cncFilesGridRad.MasterTemplate.Templates(0).Columns
col.IsVisible = False
Next
'child row column
column = Me.cncFilesGridRad.MasterTemplate.Templates(0).Columns("Name")
column.HeaderText = "Name"
column.IsVisible = True
column.ReadOnly = True
'parent rows
checkColumn = New GridViewCheckBoxColumn()
checkColumn.DataType = GetType(Integer)
checkColumn.HeaderText = "Select"
checkColumn.Name = "Select"
checkColumn.IsVisible = True
checkColumn.EditMode = EditMode.OnValueChange
checkColumn.Width = 83
Me.cncFilesGridRad.MasterTemplate.Columns.Add(checkColumn)
Me.cncFilesGridRad.Columns.Move(checkColumn.Index, 0)
commandColumn = New GridViewCommandColumn()
commandColumn.Name = "EditColumn"
commandColumn.UseDefaultText = True
commandColumn.DefaultText = "Edit"
commandColumn.FieldName = "Edit"
commandColumn.Width = 50
commandColumn.TextAlignment = ContentAlignment.MiddleCenter
Me.cncFilesGridRad.MasterTemplate.Columns.Add(commandColumn)
Me.cncFilesGridRad.Columns.Move(commandColumn.Index, 1)
descriptor.PropertyName = "Name"
Me.cncFilesGridRad.Columns("Name").SortOrder = RadSortOrder.Ascending
Me.cncFilesGridRad.MasterTemplate.SortDescriptors.Add(descriptor)
Me.cncFilesGridRad.MasterTemplate.Templates(0).AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill
Me.cncFilesGridRad.CurrentRow = Nothing
filterDescriptor.PropertyName = "Name"
filterDescriptor.[Operator] = FilterOperator.StartsWith
filterDescriptor.IsFilterEditor = True
Me.cncFilesGridRad.Columns("Name").FilterDescriptor = filterDescriptor
how to improve the rad grid performance while loading more Records?
Load the records as the page moves, i.e. one page can have 100 records, when we click second page, it will have another 100 records.. that will improve performance.
What you should be looking at is the Pagination capability. And Telerik's GridView control supports this feature naturally.
The data layer of RadGridView now supports pagination of data natively. You can still bind RadGridView to the same data providers as before with the addition of the paging option. There is a number of features, which will allow you to easily configure and manage the paging of the data.
Please refer to the following links for more details on how paging works.
http://docs.telerik.com/devtools/winforms/gridview/paging/overview#paging-overview
http://docs.telerik.com/devtools/winforms/gridview/paging/paging-panel
http://www.telerik.com/videos/winforms/radgridview-for-winforms-webinar
Related
We have a big project with lots of repos where we would like to introduce a coding standard that is followed in all repos.
We do this by adding an identical .editorconfig file in all repos.
When doing this we also format all java files by Code -> Reformat Code and filtering out *.java files.
I just noticed that this operation is not stable and intellij keeps toggling some code sections.
E.g. this code section ...
public CaasOrder toggles(final String caasOrderId, final String authHeader) {
final List<String> cardOrderIds = transactionTemplate.execute(status -> {
final Order order = getOrderWithInitiatedState(caasOrderId);
final List<String> ids = order.getCardOrders().stream().map(CardOrder::getId).collect(Collectors.toList());
return ids;
});
return transactionTemplate.execute(s -> ObjectConverter.convert(getOrderWithInitiatedState(caasOrderId)));
}
... keeps togling back and forth with this code section ...
public CaasOrder toggles(final String caasOrderId, final String authHeader) {
final List<String> cardOrderIds = transactionTemplate.execute(status -> {
final Order order = getOrderWithInitiatedState(caasOrderId);
final List<String> ids = order
.getCardOrders()
.stream()
.map(CardOrder::getId)
.collect(Collectors.toList());
return ids;
});
return transactionTemplate.execute(s -> ObjectConverter.convert(getOrderWithInitiatedState(caasOrderId)));
}
This is really annoying and hinders us from enforcing a common coding standard in an easy way.
I.e. add our .editorconfig filen and reformat all java files and make a commit!
And here is the .editorconfig file
[*]
charset = utf-8
end_of_line = crlf
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 120
tab_width = 4
ij_continuation_indent_size = 8
ij_formatter_off_tag = #formatter:off
ij_formatter_on_tag = #formatter:on
ij_formatter_tags_enabled = true
ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false
[*.java]
ij_java_align_consecutive_assignments = false
ij_java_align_consecutive_variable_declarations = true
ij_java_align_group_field_declarations = true
ij_java_align_multiline_annotation_parameters = false
ij_java_align_multiline_array_initializer_expression = false
ij_java_align_multiline_assignment = false
ij_java_align_multiline_binary_operation = false
ij_java_align_multiline_chained_methods = false
ij_java_align_multiline_extends_list = false
ij_java_align_multiline_for = true
ij_java_align_multiline_method_parentheses = false
ij_java_align_multiline_parameters = true
ij_java_align_multiline_parameters_in_calls = false
ij_java_align_multiline_parenthesized_expression = false
ij_java_align_multiline_records = true
ij_java_align_multiline_resources = true
ij_java_align_multiline_ternary_operation = false
ij_java_align_multiline_text_blocks = false
ij_java_align_multiline_throws_list = false
ij_java_align_subsequent_simple_methods = false
ij_java_align_throws_keyword = false
ij_java_align_types_in_multi_catch = true
ij_java_annotation_parameter_wrap = off
ij_java_array_initializer_new_line_after_left_brace = false
ij_java_array_initializer_right_brace_on_new_line = false
ij_java_array_initializer_wrap = off
ij_java_assert_statement_colon_on_next_line = false
ij_java_assert_statement_wrap = off
ij_java_assignment_wrap = off
ij_java_binary_operation_sign_on_next_line = false
ij_java_binary_operation_wrap = off
ij_java_blank_lines_after_anonymous_class_header = 0
ij_java_blank_lines_after_class_header = 0
ij_java_blank_lines_after_imports = 1
ij_java_blank_lines_after_package = 1
ij_java_blank_lines_around_class = 1
ij_java_blank_lines_around_field = 0
ij_java_blank_lines_around_field_in_interface = 0
ij_java_blank_lines_around_initializer = 1
ij_java_blank_lines_around_method = 1
ij_java_blank_lines_around_method_in_interface = 1
ij_java_blank_lines_before_class_end = 0
ij_java_blank_lines_before_imports = 1
ij_java_blank_lines_before_method_body = 0
ij_java_blank_lines_before_package = 0
ij_java_block_brace_style = end_of_line
ij_java_block_comment_add_space = false
ij_java_block_comment_at_first_column = true
ij_java_builder_methods = none
ij_java_call_parameters_new_line_after_left_paren = false
ij_java_call_parameters_right_paren_on_new_line = false
ij_java_call_parameters_wrap = off
ij_java_case_statement_on_separate_line = true
ij_java_catch_on_new_line = false
ij_java_class_annotation_wrap = split_into_lines
ij_java_class_brace_style = end_of_line
ij_java_class_count_to_use_import_on_demand = 999
ij_java_class_names_in_javadoc = 1
ij_java_do_not_indent_top_level_class_members = false
ij_java_do_not_wrap_after_single_annotation = false
ij_java_do_not_wrap_after_single_annotation_in_parameter = false
ij_java_do_while_brace_force = never
ij_java_doc_add_blank_line_after_description = true
ij_java_doc_add_blank_line_after_param_comments = false
ij_java_doc_add_blank_line_after_return = false
ij_java_doc_add_p_tag_on_empty_lines = true
ij_java_doc_align_exception_comments = true
ij_java_doc_align_param_comments = true
ij_java_doc_do_not_wrap_if_one_line = false
ij_java_doc_enable_formatting = true
ij_java_doc_enable_leading_asterisks = true
ij_java_doc_indent_on_continuation = false
ij_java_doc_keep_empty_lines = true
ij_java_doc_keep_empty_parameter_tag = true
ij_java_doc_keep_empty_return_tag = true
ij_java_doc_keep_empty_throws_tag = true
ij_java_doc_keep_invalid_tags = true
ij_java_doc_param_description_on_new_line = false
ij_java_doc_preserve_line_breaks = false
ij_java_doc_use_throws_not_exception_tag = true
ij_java_else_on_new_line = false
ij_java_entity_dd_suffix = EJB
ij_java_entity_eb_suffix = Bean
ij_java_entity_hi_suffix = Home
ij_java_entity_lhi_prefix = Local
ij_java_entity_lhi_suffix = Home
ij_java_entity_li_prefix = Local
ij_java_entity_pk_class = java.lang.String
ij_java_entity_vo_suffix = VO
ij_java_enum_constants_wrap = off
ij_java_extends_keyword_wrap = off
ij_java_extends_list_wrap = off
ij_java_field_annotation_wrap = split_into_lines
ij_java_finally_on_new_line = false
ij_java_for_brace_force = never
ij_java_for_statement_new_line_after_left_paren = false
ij_java_for_statement_right_paren_on_new_line = false
ij_java_for_statement_wrap = off
ij_java_generate_final_locals = false
ij_java_generate_final_parameters = false
ij_java_if_brace_force = never
ij_java_imports_layout = *,|,javax.**,java.**,|,$*
ij_java_indent_case_from_switch = true
ij_java_insert_inner_class_imports = false
ij_java_insert_override_annotation = true
ij_java_keep_blank_lines_before_right_brace = 2
ij_java_keep_blank_lines_between_package_declaration_and_header = 2
ij_java_keep_blank_lines_in_code = 2
ij_java_keep_blank_lines_in_declarations = 2
ij_java_keep_builder_methods_indents = false
ij_java_keep_control_statement_in_one_line = true
ij_java_keep_first_column_comment = true
ij_java_keep_indents_on_empty_lines = false
ij_java_keep_line_breaks = false
ij_java_keep_multiple_expressions_in_one_line = false
ij_java_keep_simple_blocks_in_one_line = false
ij_java_keep_simple_classes_in_one_line = false
ij_java_keep_simple_lambdas_in_one_line = false
ij_java_keep_simple_methods_in_one_line = false
ij_java_label_indent_absolute = false
ij_java_label_indent_size = 0
ij_java_lambda_brace_style = end_of_line
ij_java_layout_static_imports_separately = true
ij_java_line_comment_add_space = false
ij_java_line_comment_add_space_on_reformat = false
ij_java_line_comment_at_first_column = true
ij_java_message_dd_suffix = EJB
ij_java_message_eb_suffix = Bean
ij_java_method_annotation_wrap = split_into_lines
ij_java_method_brace_style = end_of_line
ij_java_method_call_chain_wrap = on_every_item
ij_java_method_parameters_new_line_after_left_paren = false
ij_java_method_parameters_right_paren_on_new_line = false
ij_java_method_parameters_wrap = off
ij_java_modifier_list_wrap = false
ij_java_multi_catch_types_wrap = normal
ij_java_names_count_to_use_import_on_demand = 3
ij_java_new_line_after_lparen_in_annotation = false
ij_java_new_line_after_lparen_in_record_header = false
ij_java_packages_to_use_import_on_demand = java.awt.*,javax.swing.*
ij_java_parameter_annotation_wrap = off
ij_java_parentheses_expression_new_line_after_left_paren = false
ij_java_parentheses_expression_right_paren_on_new_line = false
ij_java_place_assignment_sign_on_next_line = false
ij_java_prefer_longer_names = true
ij_java_prefer_parameters_wrap = false
ij_java_record_components_wrap = normal
ij_java_repeat_synchronized = true
ij_java_replace_instanceof_and_cast = false
ij_java_replace_null_check = true
ij_java_replace_sum_lambda_with_method_ref = true
ij_java_resource_list_new_line_after_left_paren = false
ij_java_resource_list_right_paren_on_new_line = false
ij_java_resource_list_wrap = off
ij_java_rparen_on_new_line_in_annotation = false
ij_java_rparen_on_new_line_in_record_header = false
ij_java_session_dd_suffix = EJB
ij_java_session_eb_suffix = Bean
ij_java_session_hi_suffix = Home
ij_java_session_lhi_prefix = Local
ij_java_session_lhi_suffix = Home
ij_java_session_li_prefix = Local
ij_java_session_si_suffix = Service
ij_java_space_after_closing_angle_bracket_in_type_argument = false
ij_java_space_after_colon = true
ij_java_space_after_comma = true
ij_java_space_after_comma_in_type_arguments = true
ij_java_space_after_for_semicolon = true
ij_java_space_after_quest = true
ij_java_space_after_type_cast = true
ij_java_space_before_annotation_array_initializer_left_brace = false
ij_java_space_before_annotation_parameter_list = false
ij_java_space_before_array_initializer_left_brace = false
ij_java_space_before_catch_keyword = true
ij_java_space_before_catch_left_brace = true
ij_java_space_before_catch_parentheses = true
ij_java_space_before_class_left_brace = true
ij_java_space_before_colon = true
ij_java_space_before_colon_in_foreach = true
ij_java_space_before_comma = false
ij_java_space_before_do_left_brace = true
ij_java_space_before_else_keyword = true
ij_java_space_before_else_left_brace = true
ij_java_space_before_finally_keyword = true
ij_java_space_before_finally_left_brace = true
ij_java_space_before_for_left_brace = true
ij_java_space_before_for_parentheses = true
ij_java_space_before_for_semicolon = false
ij_java_space_before_if_left_brace = true
ij_java_space_before_if_parentheses = true
ij_java_space_before_method_call_parentheses = false
ij_java_space_before_method_left_brace = true
ij_java_space_before_method_parentheses = false
ij_java_space_before_opening_angle_bracket_in_type_parameter = false
ij_java_space_before_quest = true
ij_java_space_before_switch_left_brace = true
ij_java_space_before_switch_parentheses = true
ij_java_space_before_synchronized_left_brace = true
ij_java_space_before_synchronized_parentheses = true
ij_java_space_before_try_left_brace = true
ij_java_space_before_try_parentheses = true
ij_java_space_before_type_parameter_list = false
ij_java_space_before_while_keyword = true
ij_java_space_before_while_left_brace = true
ij_java_space_before_while_parentheses = true
ij_java_space_inside_one_line_enum_braces = false
ij_java_space_within_empty_array_initializer_braces = false
ij_java_space_within_empty_method_call_parentheses = false
ij_java_space_within_empty_method_parentheses = false
ij_java_spaces_around_additive_operators = true
ij_java_spaces_around_annotation_eq = true
ij_java_spaces_around_assignment_operators = true
ij_java_spaces_around_bitwise_operators = true
ij_java_spaces_around_equality_operators = true
ij_java_spaces_around_lambda_arrow = true
ij_java_spaces_around_logical_operators = true
ij_java_spaces_around_method_ref_dbl_colon = false
ij_java_spaces_around_multiplicative_operators = true
ij_java_spaces_around_relational_operators = true
ij_java_spaces_around_shift_operators = true
ij_java_spaces_around_type_bounds_in_type_parameters = true
ij_java_spaces_around_unary_operator = false
ij_java_spaces_within_angle_brackets = false
ij_java_spaces_within_annotation_parentheses = false
ij_java_spaces_within_array_initializer_braces = false
ij_java_spaces_within_braces = false
ij_java_spaces_within_brackets = false
ij_java_spaces_within_cast_parentheses = false
ij_java_spaces_within_catch_parentheses = false
ij_java_spaces_within_for_parentheses = false
ij_java_spaces_within_if_parentheses = false
ij_java_spaces_within_method_call_parentheses = false
ij_java_spaces_within_method_parentheses = false
ij_java_spaces_within_parentheses = false
ij_java_spaces_within_record_header = false
ij_java_spaces_within_switch_parentheses = false
ij_java_spaces_within_synchronized_parentheses = false
ij_java_spaces_within_try_parentheses = false
ij_java_spaces_within_while_parentheses = false
ij_java_special_else_if_treatment = true
ij_java_subclass_name_suffix = Impl
ij_java_ternary_operation_signs_on_next_line = false
ij_java_ternary_operation_wrap = off
ij_java_test_name_suffix = Test
ij_java_throws_keyword_wrap = off
ij_java_throws_list_wrap = off
ij_java_use_external_annotations = false
ij_java_use_fq_class_names = false
ij_java_use_relative_indents = false
ij_java_use_single_class_imports = true
ij_java_variable_annotation_wrap = off
ij_java_visibility = public
ij_java_while_brace_force = never
ij_java_while_on_new_line = false
ij_java_wrap_comments = false
ij_java_wrap_first_method_in_call_chain = true
ij_java_wrap_long_lines = true
wildcard_import_limit = 999
[.editorconfig]
ij_editorconfig_align_group_field_declarations = false
ij_editorconfig_space_after_colon = false
ij_editorconfig_space_after_comma = true
ij_editorconfig_space_before_colon = false
ij_editorconfig_space_before_comma = false
ij_editorconfig_spaces_around_assignment_operators = true
This happens because there is two formattings going on - first you wrap at 120 (and one line is exactly 120 characters) it will wrap.
Then it will add the CRLF (as your config says).
Next time it looks at the line (without thinking about CRLF) and put's it on one line and then add the CRLF.
This is ofcourse a bug in IntelliJ - so to work around you can set max_line_length to 122 to work around it.
If you don't want to change globally you can put an editorconfig file in the directory you have problem with.
By changing the value of these two I finally got it to become stable.
ij_java_keep_line_breaks = true
ij_java_wrap_long_lines = false
I'm trying to do a program where the user can control the dimension of the input matrix and provide the necessary textboxes according to the desired dimension of the matrix. With my current lines of codes, this will probably reach a thousand lines despite the simplicity of the function. Is there a way to write this more efficiently? The boxes should show up every time "Load" is clicked.
If (RowDisplay.Text = "1" And ColumnDisplay.Text = "1") Then
Ta11.Visible = True
Ta21.Visible = False
Ta31.Visible = False
Ta41.Visible = False
Ta51.Visible = False
Ta12.Visible = False
Ta22.Visible = False
Ta32.Visible = False
Ta42.Visible = False
Ta52.Visible = False
Ta13.Visible = False
Ta23.Visible = False
Ta33.Visible = False
Ta43.Visible = False
Ta53.Visible = False
Ta14.Visible = False
Ta24.Visible = False
Ta34.Visible = False
Ta44.Visible = False
Ta54.Visible = False
Ta15.Visible = False
Ta25.Visible = False
Ta35.Visible = False
Ta45.Visible = False
Ta55.Visible = False
ElseIf (RowDisplay.Text = "2" And ColumnDisplay.Text = "1") Then
Ta11.Visible = True
Ta21.Visible = True
Ta31.Visible = False
Ta41.Visible = False
Ta51.Visible = False
Ta12.Visible = False
Ta22.Visible = False
Ta32.Visible = False
Ta42.Visible = False
Ta52.Visible = False
Ta13.Visible = False
Ta23.Visible = False
Ta33.Visible = False
Ta43.Visible = False
Ta53.Visible = False
Ta14.Visible = False
Ta24.Visible = False
Ta34.Visible = False
Ta44.Visible = False
Ta54.Visible = False
Ta15.Visible = False
Ta25.Visible = False
Ta35.Visible = False
Ta45.Visible = False
Ta55.Visible = False
End If
While I probably wouldn't recommend using all those TextBoxes in the first place. If you're going to do it that way, put them all in the same Panel, TableLayoutPanel or FlowLayoutPanel, then you can do this:
Private Sub DisplayTextBoxes(count As Integer)
For i = 0 To myContainer.Controls.Count - 1
myContainer.Controls(i).Visible = (i < count)
Next
End Sub
If, for instance, you call that with a count of 2, the controls at index 0 and 1 will have Visible set to True and the rest will have Visible set to False.
I have 2 lists approvedSuppliers and originalSupplierData
When approved Suppliers gets populated we clone the entry into the originalSupplierData . If they have modified a record but don't save we ask the user if they want to revert the changes . If they want to revert I am trying to replace the entry in approved suppliers with a clone of the original data. My current code for the revert is
Public Sub RevertChanges(SupplierID As Integer)
Dim orignalSupplier As Approved_Supplier = originalSupplierlist.Where(Function(x) x.ID = SupplierID).Single()
Dim modifiedSupplier As Approved_Supplier = ApprovedSuppliers.Where(Function(x) x.ID = SupplierID).Single()
modifiedSupplier = orignalSupplier.Clone
End Sub
The modifiedSupplier gets updated with the original values however the actual item in the list is not updated with the values.
If I modify one of the properties the list gets update. I am not sure what i am doing wrong can anyone point me in the right direction please?
Edit
The code for populating the list from the database is
supplierTableAdapter.Fill(supplierTable)
_approvedSuppliers = New List(Of Approved_Supplier)
originalSupplierlist = New List(Of Approved_Supplier)()
For Each row As ApprovedSuppliersDataset.ApprovedSupplierRow In supplierTable
supplier = New Approved_Supplier()
supplier.supplierID = row.PLSupplierAccountID
supplier.AccountNumber = row.SupplierAccountNumber
supplier.SupplierName = row.SupplierAccountName
supplier.SupplierAddress = CompileAddress(row)
supplier.Phone = CompilePhoneNumber(row)
If row.IsIDNull = False Then
supplier.ID = row.ID
If row.IsAdded_ByNull = False Then
supplier.AddedBy = row.Added_By
End If
If row.IsApprovedNull = False Then
supplier.Approved = row.Approved
End If
If row.IsAuditorNull = False Then
supplier.Auditor = row.Auditor
End If
If row.IsAudit_CommentsNull = False Then
supplier.AuditComments = row.Audit_Comments
End If
If row.IsAudit_DateNull = False Then
supplier.AuditDate = row.Audit_Date
End If
If row.IsDate_AddedNull = False Then
supplier.DateAdded = row.Date_Added
End If
If row.IsNotesNull = False Then
supplier.Notes = row.Notes
End If
If row.IsQuestionnaire_Return_DateNull = False Then
supplier.QuestionnaireReturnDate = row.Questionnaire_Return_Date
End If
If row.IsQuestionnaire_Sent_DateNull = False Then
supplier.QuestionnaireSentDate = row.Questionnaire_Sent_Date
End If
If row.IsQuestionnaire_StatusNull = False Then
supplier.QuestionnaireStatus = row.Questionnaire_Status
End If
If row.IsReplinNull = False Then
supplier.Replin = row.Replin
End If
If row.IsReview_CommentsNull = False Then
supplier.ReviewComment = row.Review_Comments
End If
If row.IsReview_DateNull = False Then
supplier.ReviewDate = row.Review_Date
End If
If row.IsReviewerNull = False Then
supplier.Reviewers = row.Reviewer
End If
If row.IsStakeholder_ContactNull = False Then
supplier.StakeholderContact = row.Stakeholder_Contact
End If
If row.IsStandardsNull = False Then
supplier.Standards = row.Standards
End If
If row.IsStandard_ExpiryNull = False Then
supplier.StandardExpiry = row.Standard_Expiry
End If
If row.IsStatusNull = False Then
supplier.Status = row.Status
End If
If row.IsSupplier_Expiry_DateNull = False Then
supplier.SupplierExpiryDate = row.Supplier_Expiry_Date
End If
If row.IsSupplier_ScopeNull = False Then
supplier.SupplierScope = row.Supplier_Scope
End If
If row.Is_T_CsNull = False Then
supplier.TC = row._T_Cs
End If
End If
supplier.ClearISDirty()
_approvedSuppliers.Add(supplier)
originalSupplierlist.Add(supplier.Clone)
Next
and for the clone we have
Public Function Clone() As Object Implements ICloneable.Clone
Dim cloned As New Approved_Supplier()
cloned.ID = Me.ID
cloned.DateAdded = Me.DateAdded
cloned.Status = Me.Status
cloned.AddedBy = Me.AddedBy
cloned.Approved = Me.Approved
cloned.AuditDate = Me.AuditDate
cloned.Auditor = Me.Auditor
cloned.AuditComments = Me.AuditComments
cloned.QuestionnaireStatus = Me.QuestionnaireStatus
cloned.QuestionnaireSentDate = Me.QuestionnaireSentDate
cloned.QuestionnaireReturnDate = Me.QuestionnaireReturnDate
cloned.ReviewDate = Me.ReviewDate
cloned.Reviewers = Me.Reviewers
cloned.ReviewComment = Me.ReviewComment
cloned.Standards = Me.Standards
cloned.StandardExpiry = Me.StandardExpiry
cloned.SupplierScope = Me.SupplierScope
cloned.Replin = Me.Replin
cloned.TC = Me.TC
cloned.Notes = Me.Notes
cloned.StakeholderContact = Me.StakeholderContact
cloned.SupplierExpiryDate = Me.SupplierExpiryDate
cloned.supplierID = Me.supplierID
cloned.AccountNumber = Me.AccountNumber
cloned.SupplierName = Me.SupplierName
cloned.SupplierAddress = Me.SupplierAddress
cloned.Phone = Me.Phone
cloned.Email = Me.Email
cloned.ClearISDirty()
Return cloned
End Function
You are not replacing in the list by affecting modifiedSupplier.
Try by getting the index of the modifiedSupplier and then replacing the item at the found index by your clone.
Public Sub RevertChanges(SupplierID As Integer)
Dim orignalSupplier As Approved_Supplier = originalSupplierlist.Where(Function(x) x.ID = SupplierID).Single()
Dim modifiedIndex As Integer = ApprovedSuppliers.FindIndex(Function(x) x.ID = SupplierID)
ApprovedSuppliers(modifiedIndex) = orignalSupplier.Clone()
End Sub
For the first time when I run my window application it will successfully run, but when I change the database column and binding then it gives me an error that specific data column is not there in database; also I am make null chart datasource but it gives an error. Please help.
Dim ctrArr As Integer
Dim serCnt As Integer
Dim series1 As New Series
Dim seriesFound As Boolean = False
For serCnt = 0 To ctrChart.Series.Count - 1
ctrChart.Series(0).ArgumentDataMember = ""
ctrChart.Series(0).ValueDataMembers(0) = ""
ctrChart.Series(0).Visible = False
Next
For ctrArr = 0 To gStrYAxisParamArray.Length - 1 'deptname'
For serCnt = 0 To ctrChart.Series.Count - 1
If UCase(Trim(gStrYAxisParamArray(ctrArr))) = UCase(ctrChart.Series(serCnt).Name.ToString) Then
ctrChart.Series(serCnt).ArgumentDataMember = ""
ctrChart.Series(serCnt).ValueDataMembers(0) = ""
ctrChart.Series(serCnt).Visible = True
ctrChart.Series(serCnt).ArgumentDataMember = gxAxis
ctrChart.Series(serCnt).ValueDataMembers.Item(0) = Trim(gStrYAxisParamArray(ctrArr))
seriesFound = True
Exit For
End If
Next
If seriesFound = False Then
series1 = New Series(Trim(gStrYAxisParamArray(ctrArr)).ToString, ViewType.Bar)
'ctrChart.Series.AddRange(New Series() {series1, series2})
ctrChart.Series.Add(series1)
series1.ArgumentDataMember = ""
series1.ValueDataMembers(0) = ""
series1.Visible = True
series1.ArgumentDataMember = gxAxis
series1.Label.Border.Visible = False
series1.ValueDataMembers(0) = Trim(gStrYAxisParamArray(ctrArr))
series1.LegendText = Trim(gStrYAxisParamArray(ctrArr).ToString)
End If
seriesFound = False
Next
cmbSeries.Items.Clear()
For ctrArr = 0 To ChrtStockDept.Series.Count - 1
With cmbSeries.Items
cmbSeries.Items.Add(ChrtStockDept.Series(ctrArr).Name.ToString)
End With
Next
I am using the ZedGraph control (zgc) to create individual stacked bar charts and display them in a single stacked column as shown in the image below.
The issue that I am having is that I have no control over the number of panes that are displayed in the control as this is determined by the number of items in a listbox. It seems that the default nature of the control allows the height of the graph panes to change depending on the number of panes that are displayed within the control.
The zgc is set to dock=fill within a panel control that is set to dock=fill within the form. I would like to force the graph panes to be a static height and when needed have a vertical scroll bar appear in the panel when the number of graph panes exceeds the height of the form. How can I go about achieving this? My code for creating and populating the zgc is posted below the image.
Private Sub CreateGraph(ByVal dat As Date)
Dim count As Integer = 0
Dim master As MasterPane = zgc.MasterPane
master.Fill = New Fill(Color.FromArgb(180, 180, 180), Color.FromArgb(180, 180, 180), 45.0F)
master.PaneList.Clear()
master.Title.IsVisible = True
master.Title.Text = "Workload for " & dat.ToShortDateString()
master.Margin.All = 10
master.InnerPaneGap = 5
master.IsCommonScaleFactor = False
For Each mach As String In lbMach.Items
rowCount = 0
Dim myPaneT As New GraphPane(New Rectangle(10, 10, 10, 10), "", "Time in Minutes", mach)
myPaneT.Fill.IsVisible = False
myPaneT.Chart.Fill = New Fill(Color.White, Color.White, 45.0F)
myPaneT.BaseDimension = 3.0F
myPaneT.XAxis.Title.IsVisible = False
myPaneT.XAxis.Scale.IsVisible = False
myPaneT.XAxis.Scale.Min = 0
myPaneT.XAxis.Scale.Max = (MeiSettings.WrkHrs * 60)
myPaneT.Legend.IsVisible = True
myPaneT.Border.IsVisible = False
myPaneT.Title.IsVisible = False
myPaneT.XAxis.MajorTic.IsOutside = False
myPaneT.XAxis.MinorTic.IsOutside = False
myPaneT.XAxis.MajorGrid.IsVisible = True
myPaneT.XAxis.MinorGrid.IsVisible = True
myPaneT.Margin.All = 1
If count = lbMach.Items.Count - 1 Then
myPaneT.XAxis.Title.IsVisible = True
myPaneT.XAxis.Scale.IsVisible = True
myPaneT.Margin.Bottom = 10
End If
If count > 0 Then
myPaneT.YAxis.Scale.IsSkipLastLabel = True
End If
myPaneT.YAxis.MinSpace = 20
myPaneT.Y2Axis.MinSpace = 20
Dim dt As DataTable = ItemsByMachineDT(mach, dat)
Dim myCurve As BarItem
If dt.Rows.Count > 0 Then
Dim profName As String = Nothing
Dim timeDur() As Double
For Each dr As DataRow In dt.Rows
If profName = dr("PRO").ToString() Then
timeDur = {((Convert.ToDouble(dr("QTY")) / Convert.ToDouble(dr("MPM"))))}
Else
timeDur = {((Convert.ToDouble(dr("QTY")) / Convert.ToDouble(dr("MPM")) + Convert.ToDouble(dr("Time"))))}
End If
myCurve = myPaneT.AddBar(dr("JOB").ToString & " - " & dr("PRO").ToString(), timeDur, Nothing, BarColor(rowCount))
If MeiSettings.IsGradient = True Then
myCurve.Bar.Fill = New Fill(BarColor(rowCount), Color.White, BarColor(rowCount), 90.0F)
Else
myCurve.Bar.Fill = New Fill(BarColor(rowCount), BarColor(rowCount), BarColor(rowCount), 90.0F)
End If
rowCount += 1
profName = dr("PRO").ToString()
Next
End If
myPaneT.YAxis.MajorTic.IsBetweenLabels = True
myPaneT.YAxis.Type = AxisType.Text
myPaneT.BarSettings.Type = BarType.Stack
myPaneT.BarSettings.Base = BarBase.Y
master.Add(myPaneT)
count += 1
Next
zgc.IsShowPointValues = True
Using g As Graphics = Me.CreateGraphics()
master.SetLayout(g, PaneLayout.SingleColumn)
master.AxisChange(g)
End Using
End Sub
to get control for each GraphPane :
GraphPane temp = zgc.MasterPane.PaneList.ElementAt(ind); //ind => index of the graphpane in zedgraphcontrol
to set static height n width ZedgraphControl :
zgc.Size = new Size(Width,Height);
to set visibility of scrollbar ZedgraphControl :
zgc.IsShowHScrollBar = true;
zgc.IsShowVScrollBar = true;