Hi, @Maria . Welcome Microsoft Q&A.
According to the documentation DateTime.TryParseExact, there is no overload for DateTime.TryParseExact that takes 3 parameters.
You could modify the code as follows.
if( DateTime.TryParseExact(textBox.Text, "hh:mm", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime result))
I made a sample code according to your description, you can try to refer to it.
MainWindow.xaml:
<StackPanel >
<TextBox x:Name="textBox" Height=" 50" Width="400" Background="AliceBlue" Text="{Binding Txt ,Mode=TwoWay ,UpdateSourceTrigger=PropertyChanged}"/>
<DataGrid x:Name="dgr" ItemsSource="{Binding Datas}" SelectedItem="{Binding Selected}" AutoGenerateColumns="False">
<DataGrid.Columns >
<DataGridTextColumn Header="InterestedinVac" Binding="{Binding Path=InterestedinVac}"/>
<DataGridTextColumn Header="Date" Binding="{Binding Path=DT}"/>
</DataGrid.Columns>
</DataGrid>
<Button x:Name="btn" Click="addInterviewTime" Height="50" Width="400" Content="click"/>
</StackPanel>
Codebedhind:
272403-new-text-document-9.txt
----------------------------------------------------------------------------
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.