Click here to Skip to main content
15,903,362 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Make application's forms independent from Screen resolution Pin
satc7-Feb-16 9:18
satc7-Feb-16 9:18 
GeneralRe: Make application's forms independent from Screen resolution Pin
Eddy Vluggen7-Feb-16 9:23
professionalEddy Vluggen7-Feb-16 9:23 
GeneralRe: Make application's forms independent from Screen resolution Pin
satc7-Feb-16 9:24
satc7-Feb-16 9:24 
GeneralRe: Make application's forms independent from Screen resolution Pin
Eddy Vluggen7-Feb-16 9:40
professionalEddy Vluggen7-Feb-16 9:40 
GeneralRe: Make application's forms independent from Screen resolution Pin
satc7-Feb-16 8:54
satc7-Feb-16 8:54 
SuggestionRe: Make application's forms independent from Screen resolution Pin
Richard Deeming8-Feb-16 2:20
mveRichard Deeming8-Feb-16 2:20 
GeneralRe: Make application's forms independent from Screen resolution Pin
satc9-Feb-16 5:24
satc9-Feb-16 5:24 
QuestionDatagridview date sort - Tons of examples online, no answers Pin
Dan Chapin5-Feb-16 3:09
Dan Chapin5-Feb-16 3:09 
I have an xml file that I am loading into a datagridview. Pretty simple and loads with no problem.

<?xml version="1.0" encoding="utf-8"?>
<!--Project Time Tracking-->
<TimeTracking>
  <Ticket Client="150-338" Code="Overview" Call="33685" Start_Time="1/12/2015 10:04:56 AM" Stop_Time="1/12/2015 2:09:04 PM" TimeNote="">04:04:08</Ticket>
  <Ticket Client="150-310" Code="Documents" Call="32201" Start_Time="11/20/2014 11:42:20 AM" Stop_Time="11/20/2014 3:21:04 PM" TimeNote="install and test 1099 again internally.">04:39:44</Ticket>
  <Ticket Client="609-327" Code="Misc Implementation" Call="34453" Start_Time="2/20/2015 10:15:36 AM" Stop_Time="2/20/2015 10:45:36 AM" TimeNote="Help with docusign and discuss Trust account">00:30:00</Ticket>
</TimeTracking>


Now, as you can see there is a Start_Time and Stop_Time column. Like tons of other folks, I am trying to sort the date columns Descending with no luck. When I use the grid to sort, or add my own programmatic sorting, it does not sort in date order, but in text format. From what I have read, this is because the data is being seen as a string and not a date.

Below is my simple code to load the xml

Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click
       Dim myXMLTime As String = "C:\myBSG\myBSGTimeclock.xml"
       DataGridView2.Columns.Clear()
       DataGridView2.Rows.Clear()

       dsTime.ReadXml(myXMLTime)
       DataGridView2.DataSource = dsTime
       DataGridView2.DataMember = "Ticket"

       DataGridView2.Sort(DataGridView2.Columns(6), System.ComponentModel.ListSortDirection.Descending)
   End Sub


I have played with literally hundreds of examples I have found online which attempt to address this problem with no success. Some have loaded the data into a datatable or a Dataset in an attempt to sort it there and then use that to load the datagridview. Either they did not work or were to complex for me to understand as a beginner. I cannot imagine that this could be THAT difficult as there have to be plenty of folks that need to sort by date in the Datagridview.

I need to sort load the grid with ReadXML and then be able to modify as necessary and write it back to xml using WriteXML

Any help that could be offered would be greatly appreciated!

Dan
Dan Chapin

AnswerRe: Datagridview date sort - Tons of examples online, no answers Pin
Dave Kreskowiak5-Feb-16 4:09
mveDave Kreskowiak5-Feb-16 4:09 
AnswerRe: Datagridview date sort - Tons of examples online, no answers Pin
Richard Deeming5-Feb-16 4:24
mveRichard Deeming5-Feb-16 4:24 
QuestionHow to set textbox readonly from Selected value from Combobox Pin
Reginald_13-Feb-16 2:14
Reginald_13-Feb-16 2:14 
AnswerRe: How to set textbox readonly from Selected value from Combobox Pin
Dave Kreskowiak3-Feb-16 2:45
mveDave Kreskowiak3-Feb-16 2:45 
GeneralRe: How to set textbox readonly from Selected value from Combobox Pin
Reginald_19-Feb-16 7:54
Reginald_19-Feb-16 7:54 
GeneralRe: How to set textbox readonly from Selected value from Combobox Pin
Dave Kreskowiak9-Feb-16 8:31
mveDave Kreskowiak9-Feb-16 8:31 
AnswerRe: How to set textbox readonly from Selected value from Combobox Pin
ZurdoDev9-Feb-16 8:15
professionalZurdoDev9-Feb-16 8:15 
Questionvb Pin
Member 123040962-Feb-16 18:34
Member 123040962-Feb-16 18:34 
GeneralRe: vb Pin
PIEBALDconsult2-Feb-16 18:34
mvePIEBALDconsult2-Feb-16 18:34 
SuggestionRe: vb Pin
Richard MacCutchan2-Feb-16 22:11
mveRichard MacCutchan2-Feb-16 22:11 
GeneralRe: vb Pin
Sascha Lefèvre2-Feb-16 22:54
professionalSascha Lefèvre2-Feb-16 22:54 
QuestionRe: vb Pin
CHill604-Feb-16 4:01
mveCHill604-Feb-16 4:01 
GeneralRe: vb Pin
Sascha Lefèvre4-Feb-16 4:12
professionalSascha Lefèvre4-Feb-16 4:12 
AnswerRe: vb Pin
ZurdoDev9-Feb-16 8:16
professionalZurdoDev9-Feb-16 8:16 
Questionneed an urgent helpfor making graph and the values for those plotting graph to be taken from my excel files. Pin
Member 122569872-Feb-16 3:20
Member 122569872-Feb-16 3:20 
AnswerRe: need an urgent helpfor making graph and the values for those plotting graph to be taken from my excel files. Pin
Sascha Lefèvre2-Feb-16 4:07
professionalSascha Lefèvre2-Feb-16 4:07 
QuestionVB.Net AddHandler from inside an Event Pin
Member 1229351629-Jan-16 14:51
Member 1229351629-Jan-16 14:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.