|
Declare a control TextBox using the contactenated string as the name. I think this works.
Dim oTB as new textbox("textboxname")
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: Dim oTB as new textbox("textboxname")
Doesnt seem to work.
It say "Too many Arguments to Public Sub New()"
However...
I tried this
Dim oTB As New TextBox
For a = 1 To INumOfBox2
oTB.Name = "TextBox"
oTB.Name = oTB.Name & Str(a)
oTB.Visible = True
Next
It accepts it, but doesn't make visible the Text Boxes
------------------------------------
"I want you to imagine I have a blaster in my hand" - Zaphod Beeblebrox.
"You DO have a blaster in your hand" - Freighter Pilot
"Yeah, so you don't have to tax your imagination too hard" - Zaphod Beeblebrox
|
|
|
|
|
I think you will need to use reflections to get at the textbox (or a case statement which is simpler but a kludge)
dim oTB as textbox
Select Case cbo.selectedvalue
case 1....
otb = txtBox1
Dalek Dave wrote: Dim oTB As New TextBox
This instantiates as new textbox which you then assign a name to and discard.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks, I will try that in the morning though, 3.21am and brain starting to fry.
I can see a way of doing it that is long winded, so I hope that your method works!
------------------------------------
"I want you to imagine I have a blaster in my hand" - Zaphod Beeblebrox.
"You DO have a blaster in your hand" - Freighter Pilot
"Yeah, so you don't have to tax your imagination too hard" - Zaphod Beeblebrox
|
|
|
|
|
Well, it should be morning and here is a work around that made me chuckle. It may not be a good one bu it works.
Create a groupbox/panel to hold your combo and 7 text boxes.
Make sure the tab order is sequential within the container - critical
in the on change event of the combo put the following (i had it in a button event for testing)
Dim oCtrl As Control = Me.cboList
Dim iLimit As Int16
iLimit = CInt(cboList.Text)
For i = 1 To iLimit
oCtrl = Me.GetNextControl(oCtrl, True)
Next
If Not IsNothing(oCtrl) Then
oCtrl.Text = iLimit
End If
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
If the textboxes are called TextBox1, Textbox2, etc. you may be able to do something like:
Dim Const TextBoxes() as TextBox = _
{TextBox1, TextBox2, TextBox3, TextBox4, TextBox5, TextBox6, TextBox7} and then do TextBoxes(a).Visible=True
|
|
|
|
|
Thanks, I knew I was on the right track, but I couldn't work out the method!
That works perfectly well, and is exactly what I need!
I was trying to treat the method TEXTBOX as an array, obviously a no no.
Cheers.
Now, onto my next problem...soon
------------------------------------
"I want you to imagine I have a blaster in my hand" - Zaphod Beeblebrox.
"You DO have a blaster in your hand" - Freighter Pilot
"Yeah, so you don't have to tax your imagination too hard" - Zaphod Beeblebrox
|
|
|
|
|
You can create the textboxes as an array control and change the indexes according to your needs, and use this code to make them visible:
for i=1 to numberselected
textbox(i).visible = trun
next i
|
|
|
|
|
Can some1 remind me how I pass a variable from one procedure to another in excel visual basic
|
|
|
|
|
without seeing the code or knowing the context, it is difficult to give a good answer, but I would suggest that you throw out the variable to a FUNCTION.
Function FunctionName(Prefix As String) As String
Do something here to generate/define/call the variable
End Function
You can call the fuction from the other module
Hope that helps
------------------------------------
"I want you to imagine I have a blaster in my hand" - Zaphod Beeblebrox.
"You DO have a blaster in your hand" - Freighter Pilot
"Yeah, so you don't have to tax your imagination too hard" - Zaphod Beeblebrox
|
|
|
|
|
Hi ,
Does any body know what %%Email%% means in this particular code.
Dim msg As New MailMessage
msg.To.Add("%%Email%%")
msg.Subject = GetSubject(emailAlertTypeID)
msg.PlainMessage.Body = TemplateBody
msg.From.Name = EmailFromName
msg.From.EMail = EmailFromEmail
msg.ReplyTo.EMail = EmailReplyToEmail
msg.ReturnPath.EMail = EmailReturnPathEmail
Because, it is not taking emails from stored procedure And how can I declare to get emails.
|
|
|
|
|
It doesn't mean anything at all.
Yous should substitute the string with a string containing the email address that you want to use.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Is it possible to do the following and if so how?
1) assign variable a range ie: Range = "A1"
2) perform calculations with the variable
ie: NewRange = Range + 1 answer = B1
|
|
|
|
|
NO , You cannot Calculate a String
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
if the format of your range remains the same, you can get the 'A' out and add one to its ASCII value and then change it back to 'B'. But I am not sure if it helps.
|
|
|
|
|
I am assuming this is XL.
You would do it like this...
Range("A1").Select
Offset(0,1).Select
Of course the (0,1) could be reassigned as variables and called within the Offset method.
That way you do the calculation then apply to the Offset and move around like that.
Hope that helps.
------------------------------------
"I want you to imagine I have a blaster in my hand" - Zaphod Beeblebrox.
"You DO have a blaster in your hand" - Freighter Pilot
"Yeah, so you don't have to tax your imagination too hard" - Zaphod Beeblebrox
|
|
|
|
|
I would like to know how many bytes are sent/received by my application which is using TCP/IP.
There are Windows Counters which let you know the total amount of data sent/received by RAS or LAN adapters but I didn't find code to know what my process is sending (execpt for some professional and expensive tools which monitors everything and are third party software).
I cannot just count my bytes because TCP/IP overhead is also present and I want to include that too in my statistics.
Thank you.
|
|
|
|
|
I have several usercontrols that inherit from an other control.
I need to be able to set a property for all these (and other) controls.
But I don't really want to be writing a select case for all these controls, is there any way to know the type of the 'base' control?
|
|
|
|
|
I have some extended controls (tabcontrols, textboxes, etc).
I use checks like:
For Each oControl As Control In fraOffsets.Controls
With oControl
If TypeOf oControl Is TextBox Then
'Do work here....
End If
End With
Next
All textboxes on this frame are extended, but pass because they are all of type textbox. If your talking about a composite control, I don't know - other than you might set a property to designate it (like Tag or create one).
Did either of these suggestions work for you TDDragon?
modified on Friday, July 25, 2008 2:48 PM
|
|
|
|
|
I'm looking for any advice on what is a good barcode scanning device that is easy to use with VB2005. I'm thinking of developing an application that would read a Fed Ex barcode and update one of our internal systems with the tracking number. Thank you.
|
|
|
|
|
AFAIK most barcode scanners act as a second keyboard, that is they emit text as
if it was typed. With often the option to prefix and append two selectable literal strings,
so you can differentiate a scan result from simple typing.
|
|
|
|
|
I have code like
Dim subject As String = "Test EmbeddedImage"
Dim contentId As String = "image1"
Dim body As String = "Here is a picture of CRM:
Dim av1 As AlternateView = AlternateView.CreateAlternateViewFromString(body, Nothing, "Text/Html")
Dim linkedResource1 As LinkedResource = New LinkedResource(ms,?????)
linkedResource1.ContentId = contentId
av1.LinkedResources.Add(linkedResource1)
.
.
other code for sending mail
.
.
What should I write at ????
for sending mail with image ?
|
|
|
|
|
please read carefully ...
I have a Picture box on the form ...
and I want to send that image with mail which appears in pictute box
Now I have a code that takes the image from folder structure
like c:\temp\aaa.jpg
It sends image with mail PERFECTLY....
but now I have to send mail which is store in memory stream .
not in file...
I have code
like
How can I send the image wich stored in memory stream ???
I have code
like
Public sub senmail(ByVal image1 as Image)
Dim subject As String = "Test EmbeddedImage"
Dim contentId As String = "image1"
Dim body As String = "Here is a picture of CRM:
Dim ClientPC As New SmtpClient("ddd.com", 25)
Dim Authentication As New Net.NetworkCredential("nmy@myserver.com", "password")
ClientPC.Credentials = Authentication
Dim mSender As New MailAddress("nmy@myserver.com")
Dim mReceiver As New MailAddress("nmy@myserver.com")
Dim sMail As New MailMessage(mSender, mReceiver)
sMail.Subject = "Testing embedded image 25 july 3.41 PM"
Dim av1 As AlternateView = AlternateView.CreateAlternateViewFromString(body, Nothing, MediaTypeNames.Text.Html)
Dim ct, ct1 As New ContentType
Dim ct2 As New ContentType("image")
ct.MediaType = MediaTypeNames.Image.Jpeg
Dim linkedResource1 As LinkedResource = New LinkedResource(ms, ct.MediaType) <----- gives error here
linkedResource1.ContentId = contentId
av1.LinkedResources.Add(linkedResource1)
sMail.AlternateViews.Add(av1)
sMail.IsBodyHtml = True
ClientPC.Send(sMail)
end sub
|
|
|
|
|
nileshbahirshet wrote: Dim ct, ct1 As New ContentType
Try this instead:
Dim ct As New ContentType
Dim ct1 As New ContentType
IIRC, your way of definition means that ct is untyped in VB...
|
|
|
|
|
I'll try to explain :
look this example :
Module
Module1
Sub Main()
Dim num AsDouble = 1.25
Console.WriteLine(Math.Round(num, 1, MidpointRounding.AwayFromZero))
num = 1.225
Console.WriteLine(Math.Round(num, 2, MidpointRounding.AwayFromZero))
num = 1.2225
Console.WriteLine(Math.Round(num, 3, MidpointRounding.AwayFromZero))
num = 1.22225
Console.WriteLine(Math.Round(num, 4, MidpointRounding.AwayFromZero))
num = 1.222225
Console.WriteLine(Math.Round(num, 5, MidpointRounding.AwayFromZero))
num = 1.2222225
Console.WriteLine(Math.Round(num, 6, MidpointRounding.AwayFromZero))
EndSub
End
Module
The output of this sample console application is :
1,3
1,23
1,223
1,2223
1,22222
1,222223
Is there something wrong ?
In my application I must use five decimal digits and this round method.
Regards
Andrea
|
|
|
|