Menu
  • HOME
  • TAGS

How can I load and sort button controls dynamically, based on changing data?

c#,winforms,runtime,controls

Have you tried using flowLayoutPanel? it is a control panel that will align and position all controls inside it automatically for yourself it has 4 direction in the property FlowDirection, try using that and I think you will just have to use this configurations flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight; flowLayoutPanel.WrapContents = true;...

Is there a WP8 Panel control with background image property

c#,controls,windows-phone-8.1

You can set a background image on a Grid In XAML: <Grid> <Grid.Background> <ImageBrush ImageSource="myimage.png"/> </Grid.Background> <!--Your controls here--> </Grid> ...

Can I loop through my controls and retrieve the name of their assigned properties?

vb.net,properties,controls

I need to get the name of the two checkboxes You've already got a loop; use it: For Each CheckBox In CheckBoxArray If CheckBox.Checked = True Then Debug.Print(CheckBox.Name) End If Next ...

Get Controls of a type and name

c#,arrays,controls

You can use Where extension method of LINQ TextBox[] title = MView.Controls.OfType<TextBox>().Where(d=>d.Name.Contains("title")).ToArray(); Also you can add multiple condition TextBox[] title = MView.Controls.OfType<TextBox>().Where(d=>d.Name.Contains("title") || d.Name.Contains("data")).ToArray(); ...

How to Init properties of another control asp.net

c#,asp.net,controls

I suspect that this isn't actually creating a class member: <script runat="server"> public string MacName = "UNKOWN"; </script> Instead, put it on the code-behind as a class-level property: class control1 { public string MacName { get; set; } // etc. } Then you should be able to set it on...

Click-through Controls in VB.NET

vb.net,winapi,controls,click-through

If you don't want a window to receive input you have to disable it, calling the EnableWindow function: Enables or disables mouse and keyboard input to the specified window or control. When input is disabled, the window does not receive input such as mouse clicks and key presses. Mouse messages...

Copy EventHandler of a Control to another

c#,controls

You cannot do this. Events only allow you to add or remove handlers, you cannot get a list of all of the handlers that they have. It is a function that is intentionally removed from you. You could keep track of the handlers you assign to a particular button yourself,...

WPF image button control

wpf,button,controls

EDIT: This control can be reused throughout a project as many times as you need it acts exactly as any other control would and is used the same way as any other control library. There is no Border effect and you can add whatever hover effect you want. This is...

Force FlowLayoutPanel to re-layout all controls after they have been added and layed out prior

c#,forms,user-interface,controls

SuspendLayout/ResumeLayout are typically used when you are adding controls to FlowLayoutPanel and don't want layouting to occurs after each addition. It is suspended until you say resume (possibly even forcing it). In your case, you already have collection of controls ready. Changing WrapContents will cause layouting (obviously), but only once....

accessing dynamically created controls C#

c#,controls

The control isn't being found because you are searching the Form's Controls() collection, instead of its actual container, tabPage4. Change: ListBox listboxTest = Controls[("lst" + variableNameString)] as ListBox; To: ListBox listboxTest = tabPage4.Controls[("lst" + variableNameString)] as ListBox; Or search for the control as in the link provided by drzounds in...

How to get label text from control?

ms-access,access-vba,controls

The label can be referenced as item 0 in the parent control's .Controls collection, and the label's text is its .Caption property. If IsNull(Me.EditControl) Then msgbox "My label's text is: " & Me!EditControl.Controls(0).Caption Elseif IsNull(Me.ComboboxControl) Then msgbox "My label's text is: " & Me!ComboboxControl.Controls(0).Caption End If ...

JavaFX controller to controller - access to UI Controls

controller,javafx,controls

Don't expose the UI controls or maintain references to other controllers. Instead, expose some observable data in the controllers, and use bindings to bind everything together. For example, suppose you have a Table.fxml file which displays a TableView<Person> (Person is just the example data class) and has a corresponding controller:...

C#/XAML Error No overload for 'button_Click' matches delegate 'Windows.UI.Xaml.RoutedEventHandler'

c#,xaml,event-handling,windows-phone,controls

Button's Click event doesn't have a parameter type of EventArgs.According to MSDN page , it has to be RoutedEventArgs So your code must be : public void button_Click(object sender, RoutedEventArgs e) { var button = (Button)sender; if (button.Style != myButtonStyle) button.Style = myButtonStylePressed; else button.Style = myButtonStyle; } ...

C# one form instant access controls

c#,forms,controls

This is a strongly typed variable: Form frmPDF = Application.OpenForms["frmPDFs"]; So frmPDF is now an instance of type Form, which is the base class for your form. It's not the type of your actual form. (It's an instance of your specific form type, but that instance is known to the...

c# timer preventing button click

c#,button,timer,controls

If you have the timer ticking every 250ms that could prevent the event on the mouse click. I would check that you stop the timer after the tick if you no longer need it, and restart as I think you are doing when the user leaves the control or enter...

Add controls dynamically from another class C#

c#,controls

You could go about this a few ways. One of which would be to add a SearchFunctions object as a a property to your Form1 class. Then use that object to call the method that adds the controls. public partial class Form1 : Form { SearchFunctions src = new SearchFunctions();...

Is there a LINQy way to set all ReadOnly controls' TabStop to false?

c#,linq,controls,readonly,tabstop

To linqify your example: foreach (var control in Controls.OfType<TextBox>().Where(c => c.ReadOnly) { control.TabStop = false; } However, your example does not process all controls because a Control can contain other control. You will need a recursive descent algorithm. IEnumerable<Control> Walk(Control control) { yield return control; foreach (var child in control.Controls.SelectMany(c=>...

Removing Controls from Form (Doesn't hit every Control I want to remove)

c#,forms,controls,dynamically-generated

to avoid errors: Add the controls to an array and then remove them. try this: List<Control> controlsToBeRemoved = new List<Control>(); foreach (Control item in this.Controls.OfType<PictureBox>()) { controlsToBeRemoved.Add(item); } foreach (Control item in controlsToBeRemoved) { this.Controls.Remove(item); } ...

Windows forms, creating dynamic scroll-able panel

c#,forms,user-interface,controls

Use a Panel control (as you guessed) and set its AutoScroll property to true (this takes care of scroll bars). If your inner controls are some other UserControl objects, keep a list of them in your outer UserControl, and add them dynamically at the bottom of the stack: var innerControl...

Using a 3rd party control

vb.net,calendar,controls

Well you've downloaded the source code. Place the source code in a specific location on your pc and then compile it 9If your planning to use this control in your own project then compile it in release mode. Assuming that there are no compile errors close visual studio and then...

Edit control doesn't generate WM_COMMAND messages

winapi,controls,editcontrol

For an edit control, notifications are sent to the original parent of the control. That is, in your case, the message only window. In a comment to a similar question Raymond Chen says: Many controls cache the original parent. Not much you can do about it. You may be best...

WPF change Control size when IsExpanded changes

c#,wpf,triggers,controls,datatrigger

It should be: <Style.Triggers> <DataTrigger Binding="{Binding IsExpanded, ElementName=_expFilter}" Value="True"> <Setter Property="Height" Value="140"/> </DataTrigger> </Style.Triggers> You have IsExpaned...

Sitecore Change Layout Names

sitecore,controls,sublayout

You can change the name of the sublayout item without it affecting things. If you change the actual sublayout ascx file then you need to also change the reference field in the sublayout item but everything else is bound by the id of the item not the name....

What is the “Control.Site” Property?

c#,winforms,controls

Sites bind a Component to a Container and enable communication between them, as well as provide a way for the container to manage its components. Sites can also serve as a repository for container-specific, per-component information, such as the component name. For more information about components, see Programming with Components....

Looping Through Controls Doesn't Find TextBox Controls

c#,winforms,controls

Your code is correct. May be there's any TextBox missing which doesn't have Green color, or might be you've calculated them wrong. Edit: As you explained all TextBoxes are contained in GroupBoxes, so you've to iterate through all groupBoxes. bool IsAllGreen = true; foreach (GroupBox groupBox in this.Controls.OfType<GroupBox>()) //get all...

Adding controls to form using timers

c#,timer,controls

There are some issues with your code: Why use a static event handler and then use a work-around to access an instance variable when you could just use a non-static event handler in the first place? The timer class you use is System.Timers.Timer, there are several more different timer classes,...

How to set selectedValue to Controls.Combobox in c#?

c#,wpf,combobox,controls

WPF ComboBoxes are not the same as WinForms ones. They can display a collection of objects, instead of just strings. Lets say for example if I had myComboBox.ItemsSource = new List<string> { "One", "Two", "Three" }; I could just use the following line of code to set the SelectedItem myComboBox.SelectedItem...

Panel Control doesn't update

c#,controls

All you have done is assigning new_panel variable to pnl_page_active. It has nothing to do with Control hierarchy. You need to remove the old panel from it's parent and insert the new one: Control parent = pnl_page_active.Parent; if (parent != null) { parent.Controls.Remove(pnl_page_active); parent.Controls.Add(new_panel); } ...

mac Swift multiple keyDown events

osx,swift,controls,keydown

The repeated keydown events that occur when a key is held down are generated by the keyboard hardware. On the PC, the protocol definition says: If you press a key, its make code is sent to the computer. When you press and hold down a key, that key becomes typematic,...

C++ Win32 Static Control Transparent Background

c++,winapi,static,controls

No need to do Owner Draw, you can just use SetWindowText() and handle the WM_CTLCOLORSTATIC message, see the code in this SO Answer <-- this will not work if the window has a pattern background, we need to subclass the static control and use the transparent background mode while drawing...

Why is the text on asp.net controls is not changed when changing uiCulture

c#,jquery,asp.net,controls,globalization

Add this in ResourceClearing.aspx.vb for testing ru-RU culture. Do not set the culture outside of InitializeCulture: protected override void InitializeCulture() { Thread.CurrentThread.CurrentCulture = new CultureInfo("ru-RU"); base.InitializeCulture(); } Add this in ResourceClearing.aspx Page <asp:DropDownList ID="ddlCurrency" CssClass="form-control" runat="server" Height="16px"> <asp:ListItem Value="1" Text="<%$ Resources:shekelOpt %>"></asp:listitem> <asp:ListItem Value="2" Text="<%$ Resources:dollarOpt...

VB.Net DateTimePicker how to stop navigation button from setting a default date

vb.net,winforms,controls,datetimepicker

Figured out the my mistake. I needed to handle the 'DateSelected' event and not the 'DateChanged' event. DateChanged events are getting fired as part for the month changes when clicked on the left/right navigator button and also when the year changes.

UIView set frame and set center not applied

ios,controls

I've posted this as an answer so you can check it as valid. For anyone having this problems, the first thing I would check is if autolayout is enabled on your view's interface builder. Open your view in the Interface Builder. Now, on the utilities, show the file inspector. You...

C# Win Forms issues deleting dynamically created controls

c#,winforms,dynamic,delete,controls

Dispose is removing the control from the Controls collection as well as disposing of the control. As noted here, When a Control is removed from the control collection, all subsequent controls are moved up one position in the collection. That is why your logic is skipping every other CheckBox. Try...

Is there a variable type which can refer to a control (type may differ) in vb6?

vb6,controls

Using the "Object" Datatype worked. I needed to set it equal to the control using a Set statement SET mCombo = ssOLEDBCombo I am more familiar with vb.net/c# where this Set keyword isnt necessary....

Is it possible to use the format textbox(x).text to avoid several statements?

.net,vb.net,if-statement,textbox,controls

A variation from the solution from Mr Wilko is through the creation of specific arrays of your controls. Dim aftBoxes = new TextBox() {aft1, aft2, aft3} Dim ainBoxes = new TextBox() {ain1, ain2, ain3} Dim bftBoxes = new TextBox() {bft1, bft2, bft3} Dim binBoxes = new TextBox() {bin1, bin2, bin3}...

Visual Studio win32project control resizing [closed]

c++,visual-studio,visual-c++,controls,designer

As I know,if you use MFC or windows SDK,you must compute controls' new size and change it at runtime.You can change controls' size by SetWindowPos(a windows api) at runtime.

windows phone 8.1 silverlight calendar

xaml,silverlight,windows-phone-8.1,controls

You could take a look at the Calendar control for WindowsPhone Silverlight from ComponentOne. You could download it from https://www.componentone.com/Downloads/Download/?downloadID=133 and refer to its documentation at : http://helpcentral.componentone.com/nethelp/WPCalendar/

Add controls to a messagebox?

c#,winforms,controls,messagebox

Well, the answer you are looking for is NO. It is not possible to add other controls to MessageBox. If the current MessageBoxButtons enum doesn't provide you with your required buttons then you have no other option then to make your own, using a standard Form or a UserControl. You...

Remove controls of flowlayoutpanel and recreating it in C#

c#,controls,flowlayoutpanel

as Suggested, i shifted the creation outside (credit to Sinatr for spotting it) FlowLayoutPanel fwPanel = new FlowLayoutPanel(); private void createFLP() { int panelWidth = width * 4 + 50; int panelHeight = height * 4 + 50; fwPanel.Size = new Size(panelWidth, panelHeight); fwPanel.Location = new Point(0, 0); this.Controls.Add(fwPanel); }...

Editing data in Delphi controls and updating of its underlying dataset

delphi,dataset,controls,editing,tdbgrid

I think you might be confusing two things, namely changes being relayed back from DB-aware controls such as TDBEdits to the corresponding dataset TFields objects of the dataset, and changes in the field values being posted back from the fields to the dataset's database data. That's partly why I suggested...

C# How change the control (in dll) which already compiled

c#,wpf,winforms,properties,controls

My recommendation: Decompile the dll and manually change the designer/xaml, then recompile (assuming you have all dependencies). There are a several free decompilers for .NET. I typically use ILSpy....

get all controls of a type and change their properties

c#,winforms,reference,controls

So I solved it! Jon Skeet was right. The Tab in the TabControl didn't contain the controls I was looking for because they were all in a GroupBox! I searched for them in the GroupBox and there they were. The CheckBoxes where unchecked and everything worked perfectly as it should....

Userform controls - looping and checking value

loops,excel-vba,controls,togglebutton,userform

These are each an array of 1. BOOK = Array("TYPE1, TYPE2") STRAT = Array("FAST,MEDIUM,SLOW") They should be, BOOK = Array("TYPE1", "TYPE2") STRAT = Array("FAST", "MEDIUM", "SLOW") Variant arrays are typically zero-based; the first element in the BOOK array is at BOOK(0). They use a 1 based index when filled directly...

bind a Control's property to another control's property value on the same form

c#,winforms,c#-4.0,controls,property-binding

It is possible to do via the designer. For your control -> Properties -> Binding... But it is a lot of steps to result in a line of code in the designer file which you can add yourself just as easily in the constructor: this.groupBox.DataBindings.Add( "Enabled", this.myCheckBox, "Checked" ); ...

asp.net delete various textboxes at once with vb loop

asp.net,vb.net,textbox,controls

Yes you can do this but first you have to find the control in which textboxes are placed.If they are directly in page than this code will work this.Controls.OfType<TextBox>().ToList<TextBox>().ForEach(a => a.Text = ""); If textboxes are inside another control first you will have to find that control Control ctrl =...

Access violation assigning autocomplete strings to

delphi,autocomplete,controls

The problem is that the code you are using mis-handles interface reference counting. Here are the relevant extracts: type TEnumString = class(TInterfacedObject, IEnumString) .... Note that this class is derived from TInterfacedObject and so it manages its lifetime using reference counting. Then the code goes on like this: type TAutoCompleteEdit...

How to know an event handled by User or Application Methods?

c#,winforms,events,controls

I think this answer work correctly: public void JustCallEventByUser<TEventArgs>(Action<object, TEventArgs> method, object sender, TEventArgs e) where TEventArgs : EventArgs { var frames = new System.Diagnostics.StackTrace().GetFrames(); if (frames == null) return; // // This method (frames[0]= 'JustCallEventByUser') and declaration listener method (frames[1]= '(s, e)=>') must be removed from stack frames if...

Winforms remove controls on click

c#,winforms,menu,telerik,controls

The issue is that you are deleting the control out of the collection that you are iterating through, which causes a change in the collection and causes the loop to fail. I would suggest using a different style of loop to accomplish this. For example: private void radMenuItem3_Click(object sender, EventArgs...

DateTime picker in Win forms

c#,winforms,controls

Try to Use Following : dateTimePicker1.MinDate = new DateTime(year, month,day); dateTimePicker1.MaxDate = new DateTime(year, month,day); dateTimePicker1.ShowUpDown = true; dateTimePicker1.Format = DateTimePickerFormat.Custom; dateTimePicker1.CustomFormat = "MMMM dd"; To disable Days before the first day of current month: dateTimePicker1.MinDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); Limit Future Date : MaxDate is used as follows...

Dialog Box Delay / Not Displayed Fully for 2 Seconds While Application is Starting Up

c#,winforms,forms,controls

Try putting your long-running code in the Load event handler instead. By putting it in the Shown event handler, it causes the form to freeze until it's done loading because the shown event handler is not letting other events in the message loop, e.g. the Paint event -- get processed....

Silverlight Nested Custom Controls results in StackOverflowException

c#,xaml,silverlight,controls,stack-overflow

I stumbled upon that splendid effect myself, and as it turned out: You can't instantiate an object derived from UIElement (your line <local:Control1/> tries exactly this) in a ResourceDictionary (and generic.xaml is one), because all objects in said dictionary must be shareable. Documented here. Relevant section: Shareable Types and UIElement...

event for runtime controls in c#

c#,events,runtime,controls

When you create your label. Do this lbl.MouseDown += lbl_MouseDown; Then in your EventHandler: MessageBox.Show(((Label)sender).Name); To clarify; sender will be the object triggering the event so you need to cast it to Label and then you will be able to use its properties....

Change Z-Index of a label control in code [duplicate]

c#,controls,z-index,styling

turns out there's a BringToFront(); I was looking for bringToFront();...

How to build dynamic controls in angular js using json?

html,json,angularjs,dynamic,controls

This is pretty easy using the ng-repeat directive. Note how I assign the value of the model back to the scope variable in the ng-repeat. This allows me to retrieve it later. angular.module('formModule', []). controller('DynamicFormController', ['$scope', function($scope) { //Set equal to json from database $scope.formControls = [{ name: "Name", type:...

Page.Controls not working correctly with masterpage

c#,asp.net,class,webforms,controls

I found a solution to this in the end but was unable to find an easy means to getting all of the controls. I had to go looking for them within the other controls and eventually found them here: ArrayList PageObjects = GetPageControlIDs.AddControls(this.Controls[0].Controls[0].Controls[3].Controls[13].Controls[1].Controls[3].Controls, array, constPageID); ...

From where alsa getting their default states?

linux,controls,restore,alsa,mixer

The initial state of mixer controls is determined either by the driver or by the device itself. Furthermore, when asound.state does not yet exist, many distributions will call alsactl init. If you want a mixer control to have a specific value, you must set this value somehow. If you don't...

C# static winform controls not appearing

c#,arrays,winforms,controls

With such a vague, not-very-useful code example, it's impossible to say for sure what is wrong. That said, IndexOutOfRangeException, along with that apparently you are initializing the equipCore array once, using a field initializer, suggests that at the time it's initialized, the skillTotal variable is still set to its default...

Array of ListBox Names from a Tab C#

c#,listbox,controls

it would look something like this (based on a winforms example) List<string> listBoxNames = new List<string>(); foreach (Control control in tabPage1.Controls) { if (control.GetType() == typeof(ListBox)) { listBoxNames.Add(control.Name); } } Or the same thing in linq syntax List<string> listBoxNames = (from Control control in tabPage1.Controls where control.GetType() == typeof (ListBox)...

Wanting to create a custom mute/unmute button for the audio on a full screen video background

javascript,html5,audio,video,controls

looks like three small changes where needed 1/ quotes only around the click not the whole of the addEventListener parameters 2/ call the initialize 3/ remove extra period from function.vidmute <script> var mutebtn; intitializePlayer() // **don't forget to call the initialize** function intitializePlayer(){ //set object references vid = document.getElementById("bg"); mutebtn...

Looking for a cheaper way to update controls than Update()

c#,controls

You say that you cannot use a separate thread and that you must repaint often enough to give the user feedback. Repainting is expensive. Paint every 10th iteration or every 100ms to reduce the overhead....

Let components dropped on my control in the IDE become children of my control

delphi,controls,delphi-2009

Set csAcceptControls flag for ControlStyle. constructor TGroupPanel.Create(AOwner: TComponent); begin inherited Create(AOwner); ControlStyle := ControlStyle + [csAcceptsControls]; end; ...

Do Asp.net webform controls have topmost feature like Winforms controls do?

asp.net,winforms,controls,webpage,topmost

No, you can not do this. If you're expecting to port a winforms application to webforms feature for feature, you're going to be greatly disappointed. WebForms is still just a thin veneer over the http protocol; one that tends to peel up at the corner. If you're trying to keep...

How to create an array with textboxes in Visual Basic 6.0

arrays,vb6,controls

Your code isn't compiling because it is vb.net code. It should go without saying (but I'll say it anyway) that vb6 and vb.net are not the same thing. If you want to use an array, you will have to dimension the array with a number that is one less than...

Qt QML for Android and iOS change colors Systemwide

qt,colors,controls,qml

Did you actually try? Where did you read that it was not possible? I've not done much with palettes, but searching "palette qt 5.2" gave me SystemPalette as the second result, and it's been around since Qt 4.7. The properties are read-only, so the intention must be that you set...

looping through asp.net textboxes visual basic

asp.net,vb.net,loops,controls

You can do what you are asking but with FindControl and concatenating it properly. If CType(FindControl("txtOC" & l & "_D"), TextBox).Text <>"" Then CType(FindControl("txtOC" & l & "_D"), TextBox).Visible=true If you have trouble finding the control, put them in a placeholder and call the FindControl on the place holder object....

Should VideoJS controls (CC, audio) appear below the video element when width gets narrow?

javascript,video,width,controls,video.js

You just have to hide overflow in the controlbar .vjs-control-bar { overflow: hidden; } I setup an example fiddle here: http://jsfiddle.net/kuhmaty9/2/...

Access controls and their events in same class

c#,controls

Based on your description, I think this is what you want. If not you need to give us more info on what doesn't work. I think the problem you are facing is that your event are assigned AFTER you call ShowDialog(), which is modal. This means that the method will...