Click here to Skip to main content
15,888,330 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How to separate the hours and min.? because the hours is only added to min.? Pin
Richard Deeming17-Mar-16 2:01
mveRichard Deeming17-Mar-16 2:01 
GeneralRe: How to separate the hours and min.? because the hours is only added to min.? Pin
Richard MacCutchan15-Mar-16 10:35
mveRichard MacCutchan15-Mar-16 10:35 
AnswerRe: How to separate the hours and min.? because the hours is only added to min.? Pin
Eddy Vluggen15-Mar-16 10:10
professionalEddy Vluggen15-Mar-16 10:10 
JokeRe: How to separate the hours and min.? because the hours is only added to min.? Pin
Sascha Lefèvre15-Mar-16 10:44
professionalSascha Lefèvre15-Mar-16 10:44 
GeneralRe: How to separate the hours and min.? because the hours is only added to min.? Pin
Eddy Vluggen15-Mar-16 11:02
professionalEddy Vluggen15-Mar-16 11:02 
RantInsert data in multiple table and having froreign key... Pin
Member 1238897313-Mar-16 20:10
Member 1238897313-Mar-16 20:10 
GeneralRe: Insert data in multiple table and having froreign key... Pin
Mycroft Holmes13-Mar-16 21:25
professionalMycroft Holmes13-Mar-16 21:25 
QuestionExperiencing odd behavior when adding new row to datagridview (databound to bs) Pin
Jon_Boy4-Mar-16 3:45
Jon_Boy4-Mar-16 3:45 
The bright side - it's Friday Smile | :)

I have a datagridview that is databound with a bindingsource to a strongly typed dataset. There are 5 columns: 2 text fields, 2 combos (that have a datarelation to child tables) and a checkbox.

If I click to add a new row and manually type\select values - every thing works as expected. Meaning, as I am filling in data, there is another blank row below that is added. To help streamline data entry, I want to specify default values for the fields.

If I attempt to default values via dgv_DefaultValuesNeeded or the bs.AddingNew: All the default values are displayed correctly - but a new blank row isn't added to the end of the datagridview.

The last visible row (has all values defaulted correctly) but there isn't a blank line below? If I double click a combobox (don't even change the value - just double click it) or click the checkbox, then the change is reflected properly to the bindingsource and a new black line is added below?

I'm not sure what is going on. The comboboxes are set properly because the DisplayMember values are correct. If I click a previous row (without clicking the checkbox or selecting a combobox) the new row is removed as well - which makes it seem like it's not actually being added to the bindingsource during the AddingNew event.

Very stumped on this. Curious if anyone else has run into this. Probably missing something overly simple.

VB.NET
Private Sub bsPlantLocSub_AddingNew(sender As Object, e As System.ComponentModel.AddingNewEventArgs) Handles bsPlantLocSub.AddingNew
    Dim strTemp As String = GetNewDefaultValue_LabelPrefix()

    dsLocSetup.DataTable_PlantLocSub.PlantLocationIDColumn.DefaultValue = _Default_PlantLocID
    dsLocSetup.DataTable_PlantLocSub.LabelPrefixColumn.DefaultValue = strTemp
    dsLocSetup.DataTable_PlantLocSub.LocationSubColumn.DefaultValue = "Location:" & Strings.Right(strTemp, 4)
    dsLocSetup.DataTable_PlantLocSub.ComponentStatusColumn.DefaultValue = "IC"
    dsLocSetup.DataTable_PlantLocSub.SysLocOnlyColumn.DefaultValue = False
    bsPlantLocSub.MoveLast()
End Sub


I had also tried this in the bs.AddingNew - same behavior as listed above.

Dim dv As DataView = TryCast(bsPlantLocSub.List, DataView)
Dim drv As DataRowView = dv.AddNew
Dim strTemp As String = GetNewDefaultValue_LabelPrefix()

drv("PlantLocationID") = _Default_PlantLocID
drv("LabelPrefix") = strTemp
drv("LocationSub") = "Location:" & Strings.Right(strTemp, 4)
drv("ComponentStatus") = "IC"
drv("SysLocOnly") = False
e.NewObject = drv
bsPlantLocSub.MoveLast()

"There's no such thing as a stupid question, only stupid people." - Mr. Garrison

AnswerRe: Experiencing odd behavior when adding new row to datagridview (databound to bs) Pin
Eddy Vluggen4-Mar-16 12:04
professionalEddy Vluggen4-Mar-16 12:04 
GeneralRe: Experiencing odd behavior when adding new row to datagridview (databound to bs) Pin
Jon_Boy4-Mar-16 14:39
Jon_Boy4-Mar-16 14:39 
GeneralRe: Experiencing odd behavior when adding new row to datagridview (databound to bs) Pin
Eddy Vluggen4-Mar-16 23:37
professionalEddy Vluggen4-Mar-16 23:37 
GeneralRe: Experiencing odd behavior when adding new row to datagridview (databound to bs) Pin
Jon_Boy9-Mar-16 10:45
Jon_Boy9-Mar-16 10:45 
GeneralRe: Experiencing odd behavior when adding new row to datagridview (databound to bs) Pin
Eddy Vluggen9-Mar-16 10:58
professionalEddy Vluggen9-Mar-16 10:58 
QuestionCan someone help me "How to compute late and total hours and save to another column same datagrid view with this code"? Pin
Real Corks2-Mar-16 12:13
Real Corks2-Mar-16 12:13 
AnswerRe: Can someone help me "How to compute late and total hours and save to another column same datagrid view with this code"? Pin
Richard MacCutchan2-Mar-16 21:12
mveRichard MacCutchan2-Mar-16 21:12 
AnswerRe: Can someone help me "How to compute late and total hours and save to another column same datagrid view with this code"? Pin
Richard Deeming2-Mar-16 22:34
mveRichard Deeming2-Mar-16 22:34 
GeneralRe: Can someone help me "How to compute late and total hours and save to another column same datagrid view with this code"? Pin
Richard MacCutchan2-Mar-16 22:49
mveRichard MacCutchan2-Mar-16 22:49 
GeneralRe: Can someone help me "How to compute late and total hours and save to another column same datagrid view with this code"? Pin
Real Corks3-Mar-16 19:25
Real Corks3-Mar-16 19:25 
GeneralRe: Can someone help me "How to compute late and total hours and save to another column same datagrid view with this code"? Pin
Richard MacCutchan3-Mar-16 21:40
mveRichard MacCutchan3-Mar-16 21:40 
Questioncan someone help me to fix this in mysql vb "INVALID ATTEMP TO READ WHEN READER IS CLOSE "? Pin
Real Corks2-Mar-16 6:40
Real Corks2-Mar-16 6:40 
AnswerRe: can someone help me to fix this in mysql vb "INVALID ATTEMP TO READ WHEN READER IS CLOSE "? Pin
Dave Kreskowiak2-Mar-16 6:51
mveDave Kreskowiak2-Mar-16 6:51 
GeneralRe: can someone help me to fix this in mysql vb "INVALID ATTEMP TO READ WHEN READER IS CLOSE "? Pin
Real Corks2-Mar-16 7:41
Real Corks2-Mar-16 7:41 
GeneralRe: can someone help me to fix this in mysql vb "INVALID ATTEMP TO READ WHEN READER IS CLOSE "? Pin
Real Corks2-Mar-16 7:49
Real Corks2-Mar-16 7:49 
GeneralRe: can someone help me to fix this in mysql vb "INVALID ATTEMP TO READ WHEN READER IS CLOSE "? Pin
Dave Kreskowiak2-Mar-16 7:58
mveDave Kreskowiak2-Mar-16 7:58 
GeneralRe: can someone help me to fix this in mysql vb "INVALID ATTEMP TO READ WHEN READER IS CLOSE "? Pin
Real Corks2-Mar-16 8:15
Real Corks2-Mar-16 8:15 

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.