|
ngugi wrote: how does one go about attaching an image in Vb.net
To what??
ngugi wrote: more specifying its image and what data type is it when creating a table
What table?? And what data type are you talking about? Type of what??
|
|
|
|
|
This is a bit of a Newbie question...
I am trying to write a class which adds a control to it's host, where the host could be any suitable container such as a Panel, GroupBox, or a Form.
I know I can add a control directly to a Form for example in the following way:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)_
Handles MyBase.Load
Dim myControl As New SomeControl
With myControl
.Left = myLeft
.Top = myTop
.Width = myWidth
.Height = myHeight
.Visible = True
End With
Me.Controls.Add(myControl)
End Sub
But I'm having trouble doing it from within a class.
Public Class MyNewClass
.
.
.
Public Sub New(ByVal newLeft As Short, ByVal newRight As Short, ByVal newWidth As Short,_
ByVal newHeight As Short)
myLeft = newLeft
myRight = newRight
myWidth = newWidth
myHeight = newHeight
Dim myControl As New SomeControl
With myControl
.Left = myLeft
.Top = myTop
.Width = myWidth
.Height = myHeight
.Visible = True
End With
Me.Controls.Add(myControl)
End Sub
Clearly "Me" now refers to the instance of MyNewClass and not the Container or Form in which it is intended to go, so it's not going to work.
How should I do it?
Thanks in advance.
|
|
|
|
|
hi
pass a reference of the form to your class.
Public Sub New(ByVal newLeft As Short, ByVal newRight As Short, ByVal newWidth As Short,_ ByVal newHeight As Short, ByVal form As Form1)
regards
|
|
|
|
|
Your suggestion would work, but IMO the form should be adding the control not vice-versa.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
It's bad form to do what you're attempting. The child should know nothing of it's parent, nor should it modify the environment of the parent. The parent tells the child what to do, not the other way around.
Normally, the parent container would add the child controls to the form, with the child having implemented a common interface that the parent expects it to.
|
|
|
|
|
Thanks for your comments. It got me thinking about my whole approach.
With a little more reading I realised what I'm actually trying to do is create a User Control.
I can stick all the controls I want in it, and handle events from the "sender".
Problem is now solved and working fine.
|
|
|
|
|
1. Is it possible to automatically add the custom controls to the toolbox as soon as the reference is added to a project? Meaning, the user would not have to right click and add the controls in manually to the toolbox.
2. How can the developer determine which group the custom controls appear under in the toolbox? For example, can I lump all custom controls under a new group called "ABC controls" automatically when the reference is added or when the user right clicks and adds the controls in?
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
There is no method of having a control just pop into the ToolBox when you set a reference to a .DLL. You actually have to create an VSI installer package for the control (which is just a .ZIP file) to accomplish this.
You can find the quick'n'dirty explanation here[^]. The more cyptic Microsoft version can be found here[^].
|
|
|
|
|
Thanks for the links Dave.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
hi everyone!
i want to store good quality images in a database. how could i do that?
whre can i find sample code in this area?
|
|
|
|
|
Your question has nothing to do with the subject line. So I don't know if this is going to answer your question, but... This has been asked and answers thousands of times all over the web. Google results for "vb.net save image to sql database[^]"
|
|
|
|
|
how to copy the values of a textbox into the textbox of a webpage where the cursor is already positioned in the textbox of the webpage
|
|
|
|
|
What actually you want to achieve? Why you want to do this?
Your question is unclear to me.
|
|
|
|
|
Do you want tome kind of hover effect or something to happen when the focus is given to the text box?
|
|
|
|
|
the text from the form has to be pasted in the text area on the website page where the cursor already points when the website is opened
|
|
|
|
|
is there anyone there who can assist me in teaching me how to write programs with MATLAB programming language using Simulated Annealing technique.
thanks samuel
|
|
|
|
|
This might help you out...
http://en.wikipedia.org/wiki/MATLAB
|
|
|
|
|
awoyale wrote: how to write programs with MATLAB programming language
And this has what to do with VB.NET???
|
|
|
|
|
Hi All,
Sending bulk sms to mobile using serial port.
SMS sending is working. But each SMS takes different time(seconds) to receieve an network answer during sending SMS.
For eg: 1st number takes 4 seconds, 2nd number takes 6 sec, 3rd number takes 7 sec...etc
My problem is I have to fix a particular time(seconds) to every SMS.
I have tried with the code,
def_sec=0.0002
dt1=now
'loop
dt2=now
sec=(dt2.ToOADate - dt1.ToOADate)
if sec >= def_sec then
'send sms
else
're send
end if
but it doesn't give the result.
Give some ideas..
Thanks in Advance
|
|
|
|
|
scothyhut wrote: My problem is I have to fix a particular time(seconds) to every SMS.
What?? Are you trying to time how long it takes to send an SMS??
scothyhut wrote: but it doesn't give the result.
What DOES it give? and what are you expecting??
|
|
|
|
|
Yes Mr.Dave,
trying to time how long it takes to send an SMS...
What DOES it give?
It takes different timings (seconds) to send an sms.(i.e) first number takes 4 sec to send an sms, second number takes 6 sec,third takes 7 seconds......
what are you expecting??
what I am expecting, all numbers should takes a fixed time(seconds) to send an sms.
|
|
|
|
|
scothyhut wrote: It takes different timings (seconds) to send an sms.
So what?
scothyhut wrote: what I am expecting, all numbers should takes a fixed time(seconds) to send an sms.
No, that's simply a bad assumption. Since you have no control over what happens when your application deals with an external resource (like an SMS server), you will never get a consistent fixed time frame. You can get an AVERAGE time to send, but you need to time a bunch of messages before the number has any meaning.
|
|
|
|
|
Ok...I am trying to fix an average time between each sms sending. Because, I have to send 7 or 8 sms per minute.If nothing happen during this time, sms will be resent(saved into outbox).
How to do this? Give some idea...
|
|
|
|
|
I have two xmls and want to compare the contents of these two xmls using TreeView in VB .Net. Pls help me.
|
|
|
|
|
Since TreeView controls don't have any method of comparing themselves to other trees, you'd have to compare them using your own code. Or am I missing something??
|
|
|
|