I have a data grid which uses a Data Pager to split the data grid up into pages.
I have a button which opens a child window (for editing the data in the grid)
The problem occurs if i navigate to any other page other than 1 - then click the button to edit (which opens the child window), upon closing the child window my Data Pager jumps back to page 1. I would like it to retain the same page that i was viewing after the child window is closed.
Data Pager:
<sdk:DataPager Grid.Row="2" VerticalAlignment="Bottom" x:Name="pager" DisplayMode="FirstLastPreviousNextNumeric" PageSize="30" NumericButtonCount="4" Source="{Binding Path=ItemsSource,ElementName=MyGrid}" />
Child window closing method:
Private Sub BtnCancelClick(sender As System.Object, e As RoutedEventArgs) Handles btnCancel.Click
Close()
End Sub
As you can see, I'm not doing anything other than the default Close() method when i click my cancel button. Is this a built in problem, is there a way to override this?
Related
So i have a WindowsForm Application in Vb that contains 2 forms : FirstSreen and SecondScreen
I have a button on the FirstScreen and I want that when I click that button, it makes the SecondScreen appear and close the FirstScreen so that only the SecondScreen will remain. So i wrote this code :
Public class FirstScreen
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
SecondScreen.Show()
Close()
End Sub
End Class
But when i click the button, the SecondScreen shows up but disapears automatically with the FirstScreen.
Do you know how to solve problem ? Help needed Thanks
There is a simple fix to this problem:
Your problem is caused by Visual Studio setting Shutdown mode to when the startup form closes:
You can change this to When last form closes instead:
You can find these in the settings application tab of your project. Below is an example of where to find it:
I am using windows forms with vb.net. This form has infragistics ultra win grid. with context menu item. The item name is "Delete Item". But when the user performs mouse out from grid i want to hide context menu item and when user hover back to the grid i want to show the context menu item. How can i do this.
Step 1) write code to handle the 'BeforeToolDropdown' event
example method signature:
Private Sub ultraToolbar_BeforeToolDropdown(sender As Object, e As
BeforeToolDropdownEventArgs) Handles ultraToolbar.BeforeToolDropdown
Step 2) this gets you a very important eventArgs object. Check to see if the click occurred in the Ultragrid
If IsNothing(TryCast(e.SourceControl, UltraGrid)) Then
Step 3) Finally you want to disable the PopupMenuTool
Dim p As PopupMenuTool = CType(utb.Tools("key"), PopupMenuTool)
p.InstanceProps.Visible = DefaultableBoolean.False
Note: in the example, the PopupMenuTool was located on an UltraToolbarsManager
Just like what is said above, I'm having a problem regarding animated GIF. I have a button then if the button is clicked it show/display LOADING GIF within the button but I want that button not clickable while in the process of loading. So I use me.btn1.enabled = false but then the LOADING GIF is not working. What I mean is, it is visible but the ANIMATED LOADING GIF EFFECT not moving/working (or whatever you call that staff).
Thank you in advance!
Leave your button enabled but change the code behind so it ignores subsequent clicks if the loading process is underway. You could use a simple state flag for this.
Dim IsLoading As Boolean
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If (IsLoading) Then
Return
Else
IsLoading = True
' Update button with loading GIF, do loading logic etc.
End If
End Sub
Obviously, you will need to reset IsLoading when your load is complete.
OR, hide the button when loading and show a PictureBox containing the loading GIF in its place.
Currently when i click on a button on my vb.net form that has a color (or a picture) associated with it, it does the action of whatever it's suppose to do
But then,
it starts flashing ... ?
Is it possible to make it not flash after you click it?
edit: This is the XAML of the button
<Button Content="↑ Import" Height="57" HorizontalAlignment="Left" Margin="485,87,0,0" Name="ButtonImport" VerticalAlignment="Top" Width="126" Grid.Column="1" Background="Lime" />
If you set Focus() on something else at the bottom of the event handler for the Button it will stop the button's background from flashing.
For Example:
Private Sub ButtonRefresh_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles ButtonRefresh.Click
refresh()
ListViewOrderDetail.Focus()
End Sub
I have a silverlight page with a textblock and button on it. Like this:
<TextBlock x:Name="txbNote" Margin="50,50" Text="Hello"/>
<Button x:Name="btnCheck" Height="40" Click="btnCheck_Click" ClickMode="Press" Margin="50,50,50,50" Content="Check Service"/>
Here is the handler for the click event:
Private Sub btnCheck_Click(ByVal sender As Object, ByVal e As EventArgs) 'Handles btnCheck.Click
txbNote.Text = "I Was Clicked"
End Sub
It works... but...
Why doesn't this work?
<Button x:Name="btnCheck" Height="40" Click="btnCheck_Click" ClickMode="Press" Margin="50,50,50,50" Content="Check Service"/>
<TextBlock x:Name="txbNote" Margin="50,50" Text="Hello"/>
The only change is the relative position of the textblock and button. The button's click event (and every other event I tried) just doesn't fire unless the textblock is before the button in the xaml.
You may need to post more code as this could be an issue with the surrounding tags, such as the container that these controls are in.
If you're unable to paste it all to StackOverflow, use www.dpaste.com or www.pastebin.com.
If you place these elements in the Panel instead of the Grid, it starts working.
As you mentioned grid, if you placed two items in grid, the last item is on the top in hierarchy, all top level events are received by TextBlock, you should create two columns in grid and put items in individual columns.