|
The person you reply to gets a mail with the text. The OP might have been interested in this, but will not get a notification of your post - because you replied to me
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
First post, so I really needed that feedback. Not sure where I went wrong but will tiptoe through my next answer.
|
|
|
|
|
Jim_Snyder wrote: First post, so I really needed that feedback. And a welcome one
Jim_Snyder wrote: Not sure where I went wrong You read the question of lokeshnj, and my (incomplete) answer; then you hit reply - on my answer, not on the question of lokeshnj. To do the last, you'd have to click on that post first, and then hit reply.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I figured it out pretty quickly when I went to correct the process. I have gotten too used to forums like Mr. Excel where there is only one reply button at the bottom of the thread and smaller individual Quote and Reply buttons on each answer. Just a new forum engine to get used to!
|
|
|
|
|
Repost:
If it isn't coming from a database, an option would be to import the key column(s) into a record object, build a generic list of objects, and use .Equals to compare. The class for the record would need a method to expose how .Equals could do the compare.
Then you could take the results (non-matches) and update your control. I am working on this process in parallel.
|
|
|
|
|
im using the sms message but the message receive event handler does not working resulting to the message cannot be seen in the application
anyone can help for this problem specialy to the creator of the application
the message only seen when the application start running and call the form_load. but on its runtime it doesnt execute.
|
|
|
|
|
We can't tell you - we have no idea what your code is doing, much less how it does it.
Remember that we can't see your screen, access your HDD, or read your mind - and a question like this needs someone to look at the code and work out what you have done. We can;t do that: so start looking and find out what you do in your load event that makes it work, and see if you can see from that why iot doesn't work later. It may be you have closed the serial port, it may be you haven;t hooked up an event - we don't know and can't tell.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I have followed Josh Smith's article "Patterns - WPF Apps with the Model-View-ViewModel Design Pattern" , and examples in two books. But I still don't see what is going on in my attempt to bind a Command to a ViewModel.
In my XAML I have:
<Window x:Class="Samples.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:Samples.ViewModel"
xmlns:i="http://schemas.microsoft.com/expression/2010/interctivity"
Title="MainWindow" Style="{StaticResource styWindow}">
<Window.DataContext>
<vm:LabTechViewModel />
</Window.DataContext>
<Window.Resources>
<DataTemplate x:Key="techData">
<Border Margin="2"
BorderThickness="2"
CornerRadius="4"
BorderBrush="SteelBlue"
HorizontalAlignment="Stretch">
<Grid ShowGridLines="False" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding TechID}">
</TextBlock>
<TextBlock Grid.Row="1" Text="{Binding TechName}" FontWeight="Bold">
</TextBlock>
</Grid>
</Border>
</DataTemplate>
<DataTemplate x:Key="progBar">
<Border BorderThickness="2"
BorderBrush="Blue"
CornerRadius="4"
HorizontalAlignment="Stretch">
<Grid>
<ProgressBar HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Minimum="{Binding Minimum}"
Maximum="{Binding Maximum}"
Value="{Binding ProgressValue}"/>
<Button x:Name="progButton"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Command="{Binding ProgressCommand}"
Content="{Binding ProgressButtonContent, FallbackValue='Bite Me'}"
Background="Transparent" />
</Grid>
</Border>
</DataTemplate>
</Window.Resources>
<Grid ShowGridLines="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel>
<ComboBox x:Name="lstOperators"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
ItemsSource="{Binding LabTechs}"
ItemTemplate="{StaticResource techData}"
SelectedItem="{Binding LabTechSelected}"
SelectedIndex="0"
>
</ComboBox>
<ContentControl ContentTemplate="{StaticResource progBar}"
>
</ContentControl>
</StackPanel>
</Grid>
</Window>
An I have this in my ViewModel. Some of the ViewModel has been left out for brevity.
public LabTechViewModel()
{
_techList = DataAccess.GetAllLabTechs();
_progressCommand = new RelayCommand(param => this.OnProgressClicked());
}
private RelayCommand _progressCommand;
public ICommand ProgressCommand
{
get
{
if (_progressCommand == null)
_progressCommand = new RelayCommand(param => this.OnProgressClicked());
return _progressCommand;
}
}
void OnProgressClicked()
{
if (_progButtonContent == "Stopped, Click to Start")
{
_progButtonContent = "Scanning, click to stop";
RaisePropertyChanged("ProgressButtonContent");
RaisePropertyChanged("ProgressMaximum");
RaisePropertyChanged("ProgerssMinimum");
}
}
And I have this RelayCommand Class that was repeated in the book examples. I am including the entire class here.
class RelayCommand : ICommand
{
readonly Action<object> _execute;
readonly Predicate<object> _canExecute;
public RelayCommand(Action<object> execute, Predicate<object> canExecute)
{
if (execute == null) throw new ArgumentNullException("execute");
_execute = execute;
_canExecute = canExecute;
}
public RelayCommand(Action<object> execute) : this(execute, null) { }
public bool CanExecute(object parameters)
{
return _canExecute == null ? true : _canExecute(parameters);
}
public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}
public void Execute(object parameters)
{
_execute(parameters);
}
}
It appears that I am missing the magic link. I have a break point set at the ICommand ProgressCommand property and it never gets hit.
|
|
|
|
|
|
Set the breakpoint at the function to be executed on button click, i.e. OnProgressClicked .
Creating the command in the constructor is enough, you do need that extra safeguard in the property.
By the way, the creation of the command can be simplified to: _progressCommand = new RelayCommand(OnProgressClicked);
|
|
|
|
|
You don't need a DataTemplate - this is only complicating things for you. Move the body of the DataTemplate containing the Button and replace the ContentControl.
This space for rent
|
|
|
|
|
Dim DesChkBox As New DataGridViewCheckBoxColumn
DesChkBox.Name = "chbSelect"
DesChkBox.HeaderText = "Select"
DesChkBox.TrueValue = True
DesChkBox.FalseValue = False
grdView.Columns.Add(DesChkBox)
DesChkBox.Width = 50
grdView.ReadOnly = False
grdView.AutoGenerateColumns = False
grdView.RowHeadersWidth = 5
And through a procedure I want to check the Check Box programmatically.
Private Sub prcDefaultSelection()
Try
grdView.Rows(0).Cells(3).Value = True
Catch ex As Exception
MsgBox(Err.Description)
End Try
End Sub
The Check Box is not Checking. Please help me.
|
|
|
|
|
Given that you have also posted this is the (correct) VB forum, you might want to remove this post
|
|
|
|
|
extension method is required in c#
|
|
|
|
|
Ummm.. what? Got some context?
|
|
|
|
|
Extension methods aren't "required" they are just a "little sugar" which makes things work a little more nicely. They provide a mechanism to add methods to a class without deriving from it.
For example, if you have an extension method to remove all the vowels from a string :
public static class ExtensionMethods
{
private const string vowels = "aeiouAEIOU";
public static string RemoveVowels(this string inp)
{
StringBuilder sb = new StringBuilder(inp.Length);
foreach (char c in inp)
{
if (!vowels.Contains(c)) sb.Append(c);
}
return sb.ToString();
}
} Then you can call it as if it was a part of the string class:
string noVowels = "The quick brown fox jumps over the lazy dog.".RemoveVowels();
And since string is a sealed class, you can't derive from it - so an extension method is the only way to do that.
But...you don't have to use an extension method - you could write it as a "normal" method.
public static class GeneralMethods
{
private const string vowels = "aeiouAEIOU";
public static string RemoveVowels(string inp)
{
StringBuilder sb = new StringBuilder(inp.Length);
foreach (char c in inp)
{
if (!vowels.Contains(c)) sb.Append(c);
}
return sb.ToString();
}
} But then, you have to call it as a "normal method:
string noVowels = GeneralMethods.RemoveVowels("The quick brown fox jumps over the lazy dog.");
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Exactly. Additionally, chaining method calls looks more natural.
|
|
|
|
|
I loaded a .csv into a datatable and now I want to be able to select a specific column to work with and then convet that column to dataframe, so I can use it with RDotNet.
this is the code that I currently have and that is not working:
public void variance(REngine e, int[] x,int[] y)
{
var var1 = e.Evaluate("var").AsFunction();
var1.Invoke(x,y).AsNumeric();
}
How can I use a one dimensional array in R?
modified 24-Jun-16 16:11pm.
|
|
|
|
|
Hello,
I have referred about creating CLR from here
but I have slight different requirement.
I want to get updated/inserted values, edit it save to one column.
Say I have column named customer_name, when some one updates/inserts value to it, I want to get that data edit it, save it in different/same column.
I can get the col value by SqlDataReader and I can check value updated or not by IsUpdatedColumn.
But I am not getting how to insert/update back to database using CLR.
How can do it in CLR ?'
|
|
|
|
|
What do you mean by "edit"? How? With what? What for?
|
|
|
|
|
editing the inserted/updated values. I want to rename the values with just to maintain uniqueness in the data. I will append _number if the duplicate data is inserted/updated.
I have column 'name', whenever new duplicate names updated/inserted to the column I want rename it with name_count so that I can maintain uniqueness
I cant go for other solutions since it will take a lot of time. For a time being I have planned to do this.
|
|
|
|
|
Do your "editing" in the "CLR".
There's any number of ways maintain uniqueness; including timestamps, hash codes, SQL IDENTITY / ROWVERSION columns.
I see no need to separate the function that "maintains uniqueness" from the one that inserts / updates; it should be part of the same operation.
|
|
|
|
|
Our app has the option to switch languages. It opens the Windows Photo Viewer to view images that it creates. One requirement is when the user changes languages to also change it in Windows Photo Viewer.
Anyone know if this can be done and how?
If it's not broken, fix it until it is
|
|
|
|
|
Message Closed
modified 23-Jun-16 4:03am.
|
|
|
|
|
What does your answer have to do with the question that was asked?
This space for rent
|
|
|
|