Make An Array Created & Filled In By One Sub Accessible From Another One?
Nov 28, 2009
I have a RadioButtonList control which triggers a Sub LegalGaps on SelectedItemChanged event. This Sub creates and fills in an array the size of which depends on the User's choice of radiobutton options. The second Sub AvailableDays shall be able to read that array and highlight the days in the Calendar control accordingly on DayRender event. May I somehow declare an internally created variable a public one?
I've created a polygon shape and filled which fills blue on startup.Upon toggling a check box it should be filled yellow.It doesn't go yellow (unless i step through in debugging).
I have a checkboxlist that is filled with items from an array. I want the user to be able to select the items they want to remove then press a button and have the items be removed from the array. I have never worked with a checkboxlist before so I'm not really sure how to go about this. Here is what I have tried so far:
[Code]...
When I re-display the array into the checkboxlist it shows that nothing was removed from the array.
I have a CheckListBoxthat is filled with items from an array. I want the user to be able to select the items they want to remove then press a button and have the items be removed from the array. I have never worked with a CheckListBoxthat before so I'm not really sure how to go about this. Here is what I have tried so far:
Private Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemove.Click Dim TempNameList As New ArrayList If cmbRemove.SelectedIndex = 0 Then TempNameList.AddRange(NameList) Array.Clear(NameList, 0, NameList.Length)
When I re-display the array into the CheckListBoxthat it shows that nothing was removed from the array.
I made a web application were you can check if somebody paid for their e-ticket and if so once you push the send mail button the person will receive his/her E-ticket with all the information regarding the activities they ordered. I just have one problem the mail that I send collects data from a data grid and puts that in a static array.
Dim testarray(20, 1) As String
And of course the code to get the data from the data grid into the array A part of the html code to send the e-mail is as following
The Testarray(0, 1) and up are filled with the corresponding amount of tickets and for which activity. As you can understand if for example Testarray(1, 0) and Testarray (1, 1) do not exists because there is no corresponding ticket amount and activity in the grid. But Testarray(0, 0) and Testarray(0, 1) do exists, the person will still receive a empty line in his/her mail
I know that with a dynamic array maybe I could fix that problem, I was wondering if there is a work around so I can check if a Testarray is empty or not and then only when its filled with data it will write the line into the e-mail.
I have an issue with an app i am writing, i need to make a variable accessible to any module or class within the project but that cant be accessed outside of the app as it is accessing info the end user shouldn't have access to.
Ok, well a practice i have gotten into in the last few years is to declare a module on the same page as the main form and declare variables either friend or public (global variables). with my app public is not good so i tried Protected Friend but i cant use this within a module.
I tried placing it at the top of the main form but one of my classes can't access it, what would be the right way to do as expected. besides the main form i have 2 classes call them class1 and class2:- main interacts with both classes class1 accesses class2 class2 doesn't access class1
I'm just taking over an asp.net/vb site, and I'm definitely still learning. I'm receiving the following error: BC30451: 'ByOwner' is not declared. It may be inaccessible due to its protection level.
I call a datasource with: <asp:GridView ID="CaseCountByOwner" runat="server" AllowSorting="true" DataSourceID="ByOwner"
And here's what is in the codefile: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load HitMe.AddHit(Request.UserHostAddress, Request.UserAgent, Request.Url.ToString) Dim user As String = Request.QueryString("user") If user.Length() = 0 Then [Code] .....
So I am making kinda of wizard, with options and a next buttons all in the same form but using hide and show.I have 3 of them. How can I make variables accessible to the entire form?
Dim conn As New SqlConnection("Server=.SQLExpress;Data Source=;Integrated Security=SSPI") Dim cmd As New SqlCommand("", conn) cmd.CommandText = "CREATE DATABASE MyDBTest22 ON ( FILENAME = 'D:dbTestATTTTTTT.mdf' ), ( FILENAME = 'D:dbTestATTTTTTT_log.ldf' ) FOR ATTACH"
[code]....
It ran without any error but when I opened SSMS, I could not see my file attached to the server. Also, I tried to make a connection, but it says file does not exist but when I tried to re-run the above code, it says File already exists.Something wrong with my way of doing it? I want to see it attached with the instance of my SQL Server Express 2005, using SSMS.
In general, according to the OOP paradigm, my understanding of encapsulation basically says:
-If a member is private, it can only be accessed by the class. -If a member is protected, it can only be accessed by the base class and any derived classes. -If a member is public, it can be accessed by anyone.
If I have a nested class, can I declare a property to be accessible only to that class and the parent class it's nested within? For example:[code]In the example, I cannot directly access myNestedObject.myInt or myNestedObject.myDbl from an instance of ContainerClass if those members are Private or Protected. But suppose I don't want to make them Public,because then they are TOO exposed: they can be altered from anywhere, not just within a Container Class object. Declaring them Friend would still be too weak as that would allow them to be altered from anywhere within the application.
One of my forms has a few textboxes that are required. If I try to use an if/then statement, the form shows a message box stating the error but then continues and eventually crashes because the textbox wasn't filled out. How to I make the program stop what it's doing if the box isn't filled out?
Each business object has a matching object that contains sql calls. I'd like to restrict these sql objects in a way where they can only be used by the matching business object. How can this be achieved?
Update Greg brought up the point about testability. Since the SqlObjects will contain very business-process specific sql I don't want them reused in multiple buiness objects. (Basic CRUD operations are all code-generated) Is there a way to make the SqlObjects accessible to only one business object in the business assembly (like yshuditelu and Greg Beech showed) AND expose the SqlObjects to the unit testing assembly?
I have created 3 arrays of buttons for a form which manipulates the value in a combo box or 2 by the name of the button ( buttons named 2 through to about 70 )
This works great but the problem is, now that the buttons are in, I want to be able to change the color of the buttons when another button is clicked
ie. The first bunch of buttons is a list of locations all with unique text.the second bunch of buttons is events that happen, sign on, sign off, beach open and beach closed.
What i want to be able to do is change the color of the button clicked "before" i click sign on, sign off, beach open or beach closed.
I do not know how to reference these buttons in my code as for starters, they are numbers, which is a big no no apparently. Also, even if i change the name from just a number to something like cmdBeach(i) when creating them, i still can't refer back to cmdBeach5 in my code as the button doesn't exist yet
I'm creating an array of textboxes using this code, (x number of textboxes)
'Quantity textboxes ReDim QuantityTextBoxes(x) QuantityTextBoxes(x - 1) = New TextBox()
[Code]....
I need to sum the values of each textbox, but only if there is a value in it. I have error checking elsewhere so that isn't the issue. It keeps giving me an error saying "Object reference not set to an instance of an object."
I'm currently implementing an inventory screen, a simple grid of picture boxes which displays what the player is carrying (read from a simple array of items).
I can create a nice array of picture boxes (allowing me to easily change their .image property to display items) but now I would like to capture a click event on these newly created picboxes, so when one is clicked, the items attributes are collected from the array and displayed below.
For a picbox created in the designer, this is easy, as I just double click the control, and enter my click event in the sub that is created. How would I do this for a code created picbox however?
Here is the code I use to generate my array once the inventory form loads:
Private Sub Inventory_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim x, y As Integer
[Code]....
I have done a few tests, and I know that the names of the boxes are pb00, pb01 etc, but I cant seem to make this work.
After Filling a DataTable in GridView's DataSource . A column with check box Type appears but it created as read only column and I can't enable it or make it editable... even i tried .readonly = false and still can't be edited
Module Module1 Sub Main() IO.File.Create("C: ext.txt")
[Code]....
How to make my program not to use the newly created file 'text.txt'? Notepad fails to open it, it says (The process cannot access the file because it is being used by another process).
Public Class Form1 Dim str As String Dim strA() As String Dim strB() As String Dim f As Integer = -1 Private Sub btngo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btngo.Click If txtmain.TextLength > 0 Then str = txtmain.Text
I wanted to simply on click a button to add those newly created textboxes to an array of textboxes. Starting with those labeled "Address". But I am finding this very difficult. I am able to add those originally on the form into the array very easily. But am unable to add the newly created textboxes into the array.
Here is my code so far below.
Public Class Form1 Dim MyBoxes() As TextBox = {Address, UserName, Password} Dim Numbox As Integer = 1
I have an editor created invb.net that creates html files. And when i click the button run , the Internet Explorer opens my file that is inside the Richtextbox.