VS 2010 For Each Item As Control In Form1.Controls?
Jan 26, 2011so going through some code to clean it up instead of having:
vb
Form1.TextBox8.Font = New Font(Form1.TextBox8.Font.FontFamily, 12, FontStyle.Regular)
[code].....
so going through some code to clean it up instead of having:
vb
Form1.TextBox8.Font = New Font(Form1.TextBox8.Font.FontFamily, 12, FontStyle.Regular)
[code].....
I recently put one of my projects onto a memory stick to use on my new laptop which I now have. I installed Visual Studio on the laptop and opened my project. I could edit the code and it would work fine. But when I wanted to edit the actual design, it would give me this error when compiling:
[Code]...
i have a listview in form1 and combobox in form2..i want add every first item of listview of form1 into combobox of secondform....i did this...
ComboBox1.Items.Add(form1.ListView1.Text)
but didnot get the result..how can i get the every first item into combobox.
When I hit the submit button I want the entered data to appear in textboxes on groupForm, but this isn't happening. I have to restart the form or hit the Refresh button for the data to appear.[code]...
I added groupForm.populate() at the end of the latter function for testing purposes, but I know that shouldn't be necessary ("populate" just loops over all items in the ProfitObjects array and calls NewProfitObjectsItem for each one).
Anyway; when I submit the data from the second form, the groupForm doesn't automatically show the new data. I either have to hit the refresh button or restart the form (it calls populate() on form load).
I simply want the new item to appear immediately after Submitting it. And it should, because that's what groupForm.NewProfitObjectsItem() does. And to top it off I added groupForm.populate(). I'm assuming it's not working because it's called from an external form, or because the other form is open/has the focus.
I had two forms, first forms shows all the task details in a list and user select any task and the second form shows the details of that task in edit mode so user can edit the record, now i don't know how to pass the Task_ID of selected item from form1 to form2.
View 1 RepliesI have added controls to the form using a control array.. However, when I re-run it they stay and more appear. How do I get rid of the first set?
View 10 RepliesI want a list of all controlls in my project, not only on open forms. The reason is that i want to make an access control, and the admin will set which buttons each users can use.
What ive got so far is:
HTML
Public Sub getallforms(ByVal sender As Object)
Dim Forms As New List(Of Form)()
Dim formType As Type = Type.GetType("System.Windows.Forms.Form")
[CODE]...
This shows me all forms in project. But i cant access their controls.
Everywhere in this picture you see a blank item, or empty space, a control has failed to draw of something. In this case they are all textboxes.
picture:
think i have 2 form & one module..
form1 (has one button name button1)
form2 (also has one button name button1)
[Code]....
Using VB 2008:Situation: A Form1.BackgroundWorker calls a Form1.subroutine. That sub starts a Form1.Timer with Me.tmrOK_BlinkForm.Enabled = True...fires Timer code in event: Public Shared Sub tmrOK_BlinkForm_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrOK_BlinkForm.Tick
Form3.Visible = True
Form3.Label1.Text = gNowButtonDispText
Form3.BackColor = Color.White
Form3.Refresh()
[Code]...
There must be a way to do this, I just need the correct BackgroundWorker Syntax send Stop commad to Form1.Timer from Form3.Click_event...all inside a Form1.BackgroundWorker thread started in Form1.
What I'd like to do is position Form2 underneath the Label on Form1 when the "down arrow" button is clicked. (Basically Form2 should have the same "Left" as the Label on Form1, and its "Top" should be the Top of Label1 plus the Height of Label1.) Please see attached images for further clarification. (I did something like this in VB6 with the SetCursorPos API and the Screen.TwipsPerPixelX and Screen.TwipsPerPixelY properties, but I'm sure there is a better way to do this in .NET.)
View 7 RepliesIn my window application, Form1 variable eg. Public str as string. value blank/null when move to Form2 and Back to Form1. How to maintain Form1 varable's value when back to Form1 In vb.net if any one know, reply me soon
View 2 RepliesI have a maximized form that has controls at the top of it and a large DataGridView that is docked below all the controls. Its kind of like the Ribbon in MS Office. The controls cover about 1/4 of the screen at the top. I would like a way for the user to click a button to hide all the controls then automatically expand into the place the controls were so the user can view more data in the DataGridView and visa versa. For example, in MS Office Excel you can hide the ribbon by clicking a tiny button that has "^" on it.
I'm not very familiar with all the controls in Visual Studio so I would like to hear some recommendations. Is this situation ideal for a SplitContainer or ToolStripContainer or am I way off base here?
i have created control array , now i wann to loop around as well wann to find which control has triggered the respective event my code :
[Code]...
I have got 2 forms ----- form1 and form2
i wanted to navigate from form1 to form2. and then close form1
i did the following code.
-sub form1 _ page load
dim form as new form2
form.show()
me.close
-end sub
i also tried -- form1.close() and form1.dispose() but all in vain
Problem is that my form1 is not getting closed
I have an aboutbox1 and form1..I also have a button. When I click the button it runs the backgroundworker. My background worker then opens form1.My backgroundworker doesnt just open it, it does alot of other stuff so don't ask why im doing it like that.My problem:When the background worker opens form1, form1 is not responding.
View 3 RepliesWhich different abount Form1.Close and Form1.Dispose?
View 1 RepliesI am trying to do an if then statement on form2 that references timer1 on form1, something like...if form1.timer1_tick then the problem is that I have never worked with a second form before and I am not quite sure on how to achieve this?
View 6 RepliesI'm making an autotyper/spambot, these may seem wrong to a few or most of you but it's a $50 bet to me. But anyway, I have the controls on form 1, (TextBox1 + Start + Stop (user input), ComboBox1 + Start + Stop (For pre-defined input.)) and the pre-defined text on form2. But I have a problem with the combo box reading the data on form 2.
Example:
On timer2_tick
Sendkeys.Send(Form2.textbox1.text)
I need to be able to start with Form1, move to LoginForm, then back to Form1 taking 2 variables and the "values" they have in the LoginForm back to Form1 and using the variables. I start with the main form (Form1) and have the user enter some information. Once they click OK I have the LoginForm open. After they enter their credentials I will check to make sure they are legal users, then go back to Form1 (here is where I need to take the Username and Password with me) to log onto a server using the same credentails from the login form.
View 1 Repliesis it possible to group similar controls in a form so instead of having to change every control's property I could just change the property for the entire group?
View 1 RepliesI have these code in my project one from my lecture one that i did myself [code]what is the difference between "dim" something as new form than using the form name straightaway?
View 2 RepliesI am wondering if anyone has any idea how to make the controls stack and fill up the available space left by a control if the control is hidden or removed from the UltraGridBagLayoutPanel.
Example:
[Textbox 1]
[Textbox 2]
[Textbox 3]
[Textbox 4]
[Textbox 5]
If I hide [Textbox 3] as of now, it will disperse the space left equally and pad the remaining text boxes with the space. However, I would like it to do this...
[Textbox 1]
[Textbox 2]
[Textbox 4]
[Textbox 5]
Where all the text boxes will move up and [Textbox 4] will completely consume the space left by [Textbox 3].
How do I autoscroll my richtextbox?
Form1_Load events;
How do I make it do this event occasionally? Like maybe every 5 launches, it does the event?
I am building an inventory program. One of my forms shows the store info. It will also have a section that shows all the equipment we keep track of at that store. I am currently trying to set it up by using tab controls with textboxes for each item. The code seems ugly and sloppy and I just don't like the interface. I am looking for ideas on a better way to do this. I know I could use a datagridview, but there is lots of data and I don't think there would be enough room for it.
Here is the code I have so far.
Private Sub GetTabData(ByVal StoreNumber As String)
Dim dt As New DataTable
'DSAlrm.Reset()
Dim DaAlrm As New SqlDataAdapter
Dim MyConnection As SqlConnection
[Code] .....
If only there were an easier way of traversing ASP.NET controls in the codebehind. This has been the bane of my existence as an interning .NET developer. entifying the proper member of the ListView controls. I've deleted all the presentation code in the markup to make it easier to look, since it isn't relevant anyway. Here's the situation:Markup
<asp:ListView ID="NewProduct" runat="server" DataSourceID="NewProductSDS" DataKeyNames="ID">
<ItemTemplate>
[code].....
I am Matthew and I'm extremely new to coding and any sort of scripting language; yet I am highly interested in programming and want to learn lots about this subject. So to start myself off I am trying to create some applications which I could use in day-to-day life to just basically make life easier.So the first program I am trying to make I am already confused and not sure what the heck I have to do in order to get it functioning, I've looked on lots of videos on you tube for tutorials and they have all done a great job but some videos just don't answer my questions.When I click a button and "Form2.Show()" appears, how can I make it so that when I type text in a list box in form2, it doesn't disappear when I close it? Then once I have known done that, how can I make it so I can choose a random string of text in the list box on form2 to show up on the click of a button on form1? Then a final question is, How do I prevent fields being reset in form1 & form2 on program close? Also, is it ok for me to make a thread asking 1 simple question? or do I have to ask a handful each time to save threads or something?
View 30 RepliesRegarding my college project. i'm working on a sales system . i have a form which consist of all the following information( item code , item name , item price , quantity of item ) which is display using a data grid . data input by user using text box and all this information will be stored in a database(sales database) i'm using ms access 2007. the grand total will be displayed in a text box . and amount paid will be input in a text box too , my major problem now is how to i create a reciept that will have all this information of the purcase. i have a reciept button . what the next step ? i dont have any idea how to get the reciept done.
Imports System.Data.OleDb
Public Class Form5
Dim con As New OleDbConnection
[CODE].......................
I have login form as start up form and i call Form1 after successful validation and in Form1, i have close button on click of Close i would like to reset username and password fields on loginform to null. If i add code in form1 below i get exception Dim fmLogin As New LogInForm
An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll
Make sure you do not have an infinite loop or infinite recursion
I get above on LoginForm below statement Dim fmMain As New Form1
This gives me an error.CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(My.Settings.homepage.ToString)
View 4 Replies