*object* Naming And Using
Suppose I have a series of labels in the naming scheme of: lblLP1, lblLP2, lblLP3...
Is it possible, in some brilliant stroke of coding, to some how use a string to access the properties of the labels. For example, I have two labels: lblLP1, lblLP2. Now I have an If statement that says:
If condition 1 then someInteger = 1
Else someinteger = 2
Then I want to do this:
lblLPsomeinteger.Visible (or whatever) = True.
(where someInteger is an Integer that could be added onto the end of the label name)
Is this possible?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Naming Every Array Object
hi does anybody know how to permenantly name a every object in an array
i managed to see the indivivual object names but after its out of the loop section the name just cannot be used or found
any idea how to retain the name for every object in the array?
thks in advance for helping out
I am making a options form and i have 4 tabs. how to i set captions for each one? also how do i have each tab have different info and options to choose from.
I am trying to create range names for a large number of ranges, in order to do so I am using the createnames function and pulling the name from the row to the left. That is all working fine but I am trying to also add a suffix to the range name (i.e. _MTD). Below is my code along with the results and desired results, I have been unable to get it to work so any help would be appreciated.
Set rangetoName = Worksheets("Queries").Range("A26:B37")
Desired Result: Other_Income_Mtd
Naming A Chart In VB
Apologies if this has been asked already.
I'm having trouble naming a chart through vb
I use the following code:
ActiveChart.name = "Cluster Graph"
But then get the message:
Method 'Name' of object '_Chart' failed.
Naming A File
ey guys this is probably a noob question XD
i have the following code:
Private Sub Command1_Click()
file = InputBox("The File name please")
Open "c:file.txt" For Output As #1
Print #1, Text1.Text
i want to name the file but it does not work, what am i doing wrong here?
Is it any diffren't when you are using "هنِ" in variable names, functions, subs etc. no minor slowdown? all system's can execute the *.exe?
What naming conventions do you think is most standard (that most percentage people use). Because I go through the DirectX objects and finding out their naming conventions for subs/functions and variables but some variables begin with a lower letter (h for handle) but most do not. Some variables are in all lower case and some have a mixture of both (even in the same object).
1) When would you use Hungarian Notation (I think?) for a variable...
2) When would you use all lower case
3) When would you use both cases
4) When would you use underscores
5) When would you cut off names ('Rect' from Rectangle)
If you say "It's all up to you", then at least tell me what you do in particular.
SourceSafe Uses 8.3 Naming?
Here is my issue, I am trying to setup a SourceSafe server on a machine with a computer name of "MyServer12345" now source safe does not like this for a DB location.. it keeps giving me error messages about not being able to find the path, or that the DB is an incorrect DOS name. (It is using unc like this: \MyServer12345VSS) Now if i do an identical setup on server "MyServer" I have no issues.
Does sourcesafe require database paths to conform to DOS 8.3 naming? And why is it using UNC for the path on mapped drives??
Not sure if this is possible or not, but is there a way (beside writing it out) to get all the names for objects in a project? i.e. if I have a project that has two command button called command1 and command2, that I can get a txt created that list the name of those buttons?
Anyone, in VB, know how to name something u drew...For example..I have an application that draws a line on the form..Is there anyway to give a name to that form so it can have properties like .X1,.X2, ect..so i can manipulate it later?
Naming Project Help
im trying to make a program that will prompt the user for their first, middle, and last name. show all 3 names in seperate labels, their initials in big letters with periods after each letter. a "personal color" based on the numerical value of their three initials. also display a hybrid of their first and last name. this should be the first half of their first name and the second half of their last name. for example bob bob..would be boob
Naming A Class
i wanted to create a class called " Administrator"
but if i save it as a cls file, VB 6 says that it is not a legal object name.
SO i am just wondering if there is like any naming conflict. can someone explain??
VB Naming Conventions
I am currently designing a small application that will plugin into another larger application. I have designed and tested my small application on my own form using visual basic 6.0 pro, it works successfully. I have attached my small application to my larger application but now it does not work. I believe because the names of the text boxes in the larger application are not what i thought they where. Is there a way of finding what the names of all the text boxes and drop down lists in the larger application are? The larger application was not designed by this company and we do not have the code for it. Any suggestions on how i can over come this hurdle would be of a great help.
Thank you for your time...
This is probably impossible, but can i take some text from a textbox and make that a variable name? Lets say the user types in Keyboard, can I dim a variable with the name Keyboard?
Something along the lines of dim text1.text as string, but obviously not so simple (or maybe exactly that simple.... )
Is it possible to permanently name a check box caption on one form from an input created in another form? When I try to do this it only accepts the change whilst the form is open but reverts to the original caption when closed.
Proper Naming In Vb
what are the different proper names in vb like for example
"" = vbnullstring
1 = vbchecked (for checkbox)
0 = vbunchecked
trim$ <- dollar sign
my question is where can i find proper naming for them? thanks
Naming .REG File Help Please
Hi All! I'm new to programing and VB ( Well, did do a bit of batch file work back in the bad ol' day of DOS!).
Anyway, I need some help with the following.
I'm working on a program to export a registry key and save the .REG file. Right now it saves the file to a specific path and file name. The part I need help with is having the user name the file. It would still be saved to the specific path. I was thinking about calling a form with a text box where the user would input the filename (except the ".REG" which would be hard coded.) and click on a button to save the file.
(BTW- This will be running from a thumb drive. Thus the relative path.)
Right now the code I'm using is this (short & simple!):
'Registry Key Backup - This Works.Private Sub cmdBackup_Click()'This will export the registery info from (HKEY_LOCAL_MACHINESoftwareMyAppIIPOption)'to the app.pathShell "regedit /e ./Backups/OptionKeys.reg HKEY_LOCAL_MACHINESoftwareMyAppIIPOption"Call MsgBox("The Option Key backup has been saved. ", vbOKOnly + vbInformation + vbApplicationModal + vbDefaultButton1, "FILE SAVE")End Sub
Thanks for any help & suggestions!
ActiveX DLL Naming
Anyone have any preferences on Names for their DLLs, the Project's Name, and the Class Names ..?
For example .. version incrementing ... when you make changes to it, is it best to rename it by Version .. Like MyDllV2, MyDllV3 .. etc ..?
Also, is it best to have a seperate DLL for each class, or only seperate them if they dont need each other....
I was just curious which type of naming conventions is most widely used, and most readable. I know this can be a personal preference but I was just curious how people keep local,modual,class variables identifiable.
I ask because I am looking for a change, I have been using "Polish" Notation but want to see what else is out there.
I have a program that puts all the files with the extenstion .zip from a folder into a textbox.
My question is once I have changed the name of the file in the textbox
how would I change the original file to that name.
VB Naming Convention
Remember the naming convention we learned about? It's in my head, but I'd like a link to a detailed article.
Anyone got a link? Thanks.
Why do I get an error message range of method global failed. Erro code 1004. I declared in my code the following:
Dim myrange As Range
Set myrange = Range(Addr3)
Why do I get an error at the lines:
Look at BLUE lines in text
Public xend As Integer
Public yend As Integer
Private Sub CommandButton4_Click()
Dim c As Integer
Dim r As Integer
Dim lastcell As Integer
Dim lastcelladdr As String
Dim firstcelladdr As String
Dim myrange As Range
Dim SelRange1 As Range
Dim SelRange2 As Range
Dim selrange3 As Range
Dim Addr1 As String
Dim Addr2 As String
Dim Addr3 As String
Dim Addr4 As String
Dim lengte1 As Integer
Dim lengte2 As Integer
Dim rijnummerbegin As String
Dim rijnummereind As String
Dim kolomref As String
Dim sheetnaam As String
Dim sheetnaam2 As String
xend = UserForm2.TextBox1.Value
yend = UserForm2.TextBox2.Value
'Get the address, or reference, from the RefEdit control.
Addr1 = RefEdit1.Value
Addr2 = RefEdit2.Value
'Set the SelRange Range object to the range specified in the
Set SelRange1 = Range(Addr1)
Set SelRange2 = Range(Addr2)
'Apply a red pattern to the SelRange.
sheetnaam = ActiveCell.Parent.Name 'geeft de naam vd huidige sheet aan variabele
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
sheetnaam2 = ActiveCell.Parent.Name
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
Addr3 = RefEdit3.Value
Set myrange = Range(Addr3)
c = myrange.Cells.Count
r = myrange.Rows.Count
lastcell = (c / r) * (r - 1) + 1
lastcelladdr = myrange.Cells(lastcell).Address(rowabsolute:=False, columnabsolute:=False)
firstcelladdr = myrange.Cells(1).Address(rowabsolute:=False, columnabsolute:=False)
lengte1 = Len(lastcelladdr)
lengte2 = Len(firstcelladdr)
rijnummerbegin = Right(firstcelladdr, (lengte2 - 1))
rijnummereind = Right(lastcelladdr, (lengte1 - 1))
kolomref = Left(firstcelladdr, 1)
Dim d As Integer
For y = 1 To UserForm2.yend
For x = 1 To -UserForm2.xend
Cells((7 + x + (-1 * UserForm2.xend) * (y - 1)), 2).Select
ActiveCell.Formula = "=AVERAGE(" & sheetnaam & "!" & kolomref & CStr(rijnummerbegin - 1 + x) & ":" & kolomref & CStr(rijnummereind + 1 - y) & ")"
d = myrange.Columns.Count + 1
Range(Cells(8, 2), Cells(7 - UserForm2.xend * UserForm2.yend, 2)).Select
Selection.AutoFill Destination:=Range(Cells(8, 2), Cells(7 - UserForm2.xend * UserForm2.yend, d)), Type:=xlFillDefault
Dim c2 As Integer
Dim r2 As Integer
Dim lastcell2 As Integer
Dim lastcelladdr2 As String
Dim firstcelladdr2 As String
Dim myrange2 As Range
Dim lengte3 As Integer
Dim lengte4 As Integer
Dim rijnummerbegin2 As String
Dim rijnummereind2 As String
Dim kolomref2 As String
Addr4 = RefEdit4.Value
Set myrange2 = Range(Addr4)
c2 = myrange2.Cells.Count
r2 = myrange2.Rows.Count
lastcell2 = (c2 / r2) * (r2 - 1) + 1
lastcelladdr2 = myrange2.Cells(lastcell2).Address(rowabsolute:=False, columnabsolute:=False)
firstcelladdr2 = myrange2.Cells(1).Address(rowabsolute:=False, columnabsolute:=False)
lengte3 = Len(lastcelladdr2)
lengte4 = Len(firstcelladdr2)
rijnummerbegin2 = Right(firstcelladdr2, (lengte4 - 1))
rijnummereind2 = Right(lastcelladdr2, (lengte3 - 1))
kolomref2 = Left(firstcelladdr2, 1)
ActiveCell.Formula = "=AVERAGE(" & sheetnaam & "!" & kolomref2 & rijnummerbegin2 & ":" & kolomref2 & rijnummereind2 & ")"
Selection.AutoFill Destination:=Range(Cells(7, 2), Cells(7, d)), Type:=xlFillDefault
Set myrange3 = Range(Addr2)
firstcelladdr3 = myrange3.Cells(1).Address(rowabsolute:=False, columnabsolute:=False)
lengte5 = Len(firstcelladdr3)
rijnummerbegin3 = Right(firstcelladdr3, (lengte5 - 1))
kolomref3 = Left(firstcelladdr3, 1)
Dim mrktadj As Integer
Dim m As Integer
Dim eventrowaddr As Integer
mrktadj = Abs(xend)
m = rijnummerbegin3
eventrowaddr = m + mrktadj
ActiveCell.Formula = "=" & sheetnaam2 & "!" & kolomref3 & eventrowaddr
Selection.AutoFill Destination:=Range(Cells(10, 2), Cells(10, d)), Type:=xlFillDefault
Set myrange4 = Range(Addr1)
firstcelladdr4 = myrange4.Cells(1).Address(rowabsolute:=False, columnabsolute:=False)
lengte6 = Len(firstcelladdr4)
rijnummerbegin4 = Right(firstcelladdr4, (lengte6 - 1))
kolomref4 = Left(firstcelladdr4, 1)
c4 = myrange4.Cells.Count
r4 = myrange4.Rows.Count
lastcell4 = (c4 / r4 * (r4 - 1)) + 1
lastcelladdr4 = myrange4.Cells(lastcell4).Address(rowabsolute:=False, columnabsolute:=False)
lengte9 = Len(lastcelladdr4)
rijnummereind4 = Right(lastcelladdr4, (lengte9 - 1))
Set myrange5 = Range(Addr2)
firstcelladdr5 = myrange5.Cells(1).Address(rowabsolute:=False, columnabsolute:=False)
lengte7 = Len(firstcelladdr5)
rijnummerbegin5 = Right(firstcelladdr5, (lengte7 - 1))
kolomref5 = Left(firstcelladdr5, 1)
c5 = myrange5.Cells.Count
r5 = myrange5.Rows.Count
lastcell5 = (c5 / r5) * (r5 - 1) + 1
lastcelladdr5 = myrange5.Cells(lastcell5).Address(rowabsolute:=False, columnabsolute:=False)
lengte8 = Len(lastcelladdr5)
rijnummereind5 = Right(lastcelladdr5, (lengte8 - 1))
ActiveCell.Formula = "=INTERCEPT(" & "return_stock!" & kolomref4 & rijnummerbegin4 & ":" & kolomref4 & rijnummereind4 & "," & "return_market_index!" & kolomref5 & rijnummerbegin5 & ":" & kolomref5 & rijnummereind5 & ")"
ActiveCell.Formula = "=SLOPE(" & "return_stock!" & kolomref4 & rijnummerbegin4 & ":" & kolomref4 & rijnummereind4 & "," & "return_market_index!" & kolomref5 & rijnummerbegin5 & ":" & kolomref5 & rijnummereind5 & ")"
ActiveCell.Formula = "=B13*B14"
Selection.AutoFill Destination:=Range(Cells(13, 2), Cells(15, d)), Type:=xlFillDefault
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
ActiveCell.Formula = "=" & "return_event2!" & "B10-B$7"
Selection.AutoFill Destination:=Range(Cells(10, 2), Cells(rijnummereind, d)), Type:=xlFillDefault
I've written some functions so you can use an excel spreadsheet as a kind of database, with each sheet being a table. Currently I'm calling each function like this:
etc... kinda mySQL style. I'm thinking that the DB prefix is technically incorrect, so can anyone shed light on a more suitable one?
I'm also looking for a nice name to all the module... any ideas?
thanks in adance
After generating a user defined name, I wish to create a folder and a file using that name....the naming of the file is not a problem, but I am struggling to generate the folder name....has anyone any ideas?? Muchly appreciated...
(the user inputs their user-id, I can create the file <user-id.xls> but I cannot name the filepath c:(user-id)<user-id> as I cannot name the folder)
I'm making a program that adds objects at run-time. What I want to do is create multiple objects with "Form1.Controls.Add". Here's some code that I tried to get to work:
Dim pic As Image
Set pic = Main.Controls.Add("VB.Image", "pic")
.DragMode = 1
.Picture = LoadPicture(txtpath.Text)
.Visible = True
I want to be able to run this script more than once creating multiple "pics" without getting an error message saying that there's already a control of that name. I've tried something like this:
picnum = picnum + 1
'picnum is a global var
pic.Name = "pic" + picnum
How can I get this to work?
Can anyone direct me to some good sites that deal with organizing and naming not only variables but also how to design a good naming schema for forms, modules, COMs, StoredProcs?
ok, this is probabally really simple but,
how would i go about re-naming files?
i have a log file, and i want to put x1 at the start of the name once some data has been retrived from it.
Got a question regarding parameter naming conventions. Thought I'd run it up the flag pole and see who salutes
In a UserControl, or a DLL that is going to be distributed for developers to use, what kind of naming conventions do you think are best?
Public Sub Control_MouseDown(pintShift as Integer, psngMouseX as Single, psngMouseY as Single)
Public Sub Control_MouseDown(Shift as Integer, X As Single, Y as Single)[/code]
Do you all prefer to have info about the scope and type of a variable (this also holds for parameters for subs and functions) as in "psngMouseX", or would you rather just have the name (ie: "X"). I know MS use single names for their variables, but...
What do the other pro programmers out there use?
the p&D wizard always creates setup.exe
is there anyway to apply a meaningful name to this
Iam working in vb as front end and sqlserver as backend.I would like to know the naming standards for tables
and fields in a table.
i would also like to know if it is independent of the backend we use.
VB Naming Conventions
Hi VB Gurus and Folks,
My question is really simple, but having problems getting what I need on the Internet... where do we get the naming conventions for VB? I just want to make sure that I write the code properly... like for example, command buttons are named cmdSave, or cmdClose. I want everything to look organized in my code... But I'm having problems getting help with this. Any ideas? Somebody mentioned Programmer's Guide but where do I find that?
I am not sure if any other threads have covered this topic, if so could you point me in the right direction...
I am looking for some code that is used to re-name all files within a certain directory.
something along the lines of
Public sub Change_Name()
Dim File_Path as string
File_Path = "C:/my documents"
'Somehow find all files with a particular extension for me it will be .rep
'then code to change the .rep part to .txt
For "all files in directory??"
Mystring = Left(Myfilename,Instr(1,Myfilename,"."))
Mystring = Mystring & ".txt"
Or would it be easier using replace ?
Any help would be appreciated
This is a silly question, but how can I put spaces in the name of DLLs? When I add references, all of the preexisting ones have spaces, but VB gives me an 'Invalid Name' error when I try to put spaces in the name when creating the DLL.
Thanks in advance.
Anyone Have The MS Naming Conventions?
Can anyone help me find the M$ naming conventions? I need the standards for variables, subs and functions. Preferrably in one nice list for referrence like this:
String - str
Long - lng
Integer - int
Frames - fra
Forms - frm
Object - obj
Naming My Program
Hi all this is the part i hate trying to name my program. at the moment i have called it Help Desk but of course there are alredy quite a few called that so i really dont wanna go for that name any suggestions let me no thanks. The program is a fualt management piece of software btw.
(vb6)Naming A Control
I want to change the names of 3 option buttons of Form1 through 3 text boxes of Form2. whatever name one types out in the text boxes of Form2 those names have to be the names of the option buttons of Form1 permanently. The next time one opens Form1, he must see those names last put in the text boxes. Except putting the names in the database is it possible? please advise what to do. Thanks
Combo Box Naming
hi everyone, do u know how to name a combo box and event handler?
actually , what i m trying to do is to create several combo boxes dynamically, say, if i input number 5 , it will create 5 combo boxes with an extra one , the sixth one at the end as other control, if i input number 10, it will create 10 combo boxes with an extra one 11th at the end.
the problem here is that when i create the event handler, i dont know how to use the "name" i assigned to the last combo box. what i am doing now is creating something like
public sub ComboBox9_Click() '9 means the 9 th created combo box
however, i assign a specific name for the last combo box ,
dim lenCombo as Object
Set lenCombo = ActiveSheet.OLEObjects.Add(ClassType:="forms.ComboBox.1", Left:=120, Top:=312, Width:=45, Height:=17)
For i = 0 To columnfound - 4
i would like to know how i can create the event handler by using the specific name ?
i m sorry for the messy description.
thanks in advance
Naming A TCP / IP Connection
I am using SQL Server 7.
I am connecting to the server on Windows NT via TCP/IP protocol.
I am connecting via the address 192.168.0.1. My question is that when i am connecting to SQL Server 7 residing on Windows NT via SQL server Enterprise manager residing in a Windows 98 OS. Under the group server it is showing the server name as 192.168.0.1 for the NT connection.
Now here if i dont want the users to see the above address can i change the above address to a particular name suppose 'Myname' so that this IP address can be hidden.
I am looking for standard naming rules for variable and function on VB, by extention other naming rules for object.
Where can I get a list of the standard object and variable naming conventions?
Like str in strLastName for the variable LastName as String
Like txt in txtLastName for the object LastName as TextBox
I've just got a new job. In this company nobody cares about naming convention. In the same procedure you can find variables with names : sFirst as string, strSecond as string, Third$, lFourth as string and so on. We have a meeting scheduled for tomorrow to discuss this and similar problems. Could anybody give me any source for the most usefull naming convention system?
Naming Rules In VB
i'd like to know what are the most used rules for variables naming in VB.
Locale variable all begin with l_
Members all begin with m_
and so on!
Naming An Excel Range
I have an Excel macro and that selects certain rows (based on a text string) and then copies that row to another worksheet. This is working fine.
However, after all the necessary rows have been copied and pasted to the other sheet, I want to assign a range name to all of the copied rows. I am using the CurrentRegion.Select syntax to select all of the data, but I do not know how in VBA to give this range a name.
Any help would be great.
Naming Cell After Sheet
What I'am working on is a macro that will copy data to a result sheet. I dop this from different sheets in de workbook. I've allready, thanks to here, fixed that. What I want do now is give the cell that is in the collumn in front the copied data the name of the sheet. Like so:
Sheet name | Data| data| data
Other sheet | Data| data| data
Does anyone know how to do this?
Naming Code Modules
Hello All...And, for some, Happy 4th...
Sometime ago I figured out a way to give my code modules different names,
from: Module1, Module2, Etc...
to: Blah Blah Blah Module...Etc.
Can someone refresh my memory on how I did this?
Naming Sheets In A Workbook
If there an easy way to rename the Worksheets in a Workbook based on the contents of a cell value. I want to rename the Worksheets based on the Text that is contained in a cell. I.E. If Cell A2 = "Joe" then I want to name the sheet Joe. I will need to do this for all the Worksheets in the Workbook but the Value will always be in the same cell on each Worksheet. At times there can be 4 Worksheets or 10.
Please provide as much detail as you can.
Thanks for your help in advance.
Naming Worksheets In Excel
i'm looking to import data into a worksheet and i need to rename the worksheet dependent on the name of the file being imported.
for example: if i import 'test' i need the worksheet it imports onto to be callled 'test'
but i don't want to have to create coding for each individual report, simply because we need users to add their own imports and such.