|
Try this
1st dim your second form from your main form.
2nd In the second form user will enter data into any object (text rdo...)
3rd exiting the form will be "me.hide".
4th control is then back to the main form at which point you can read the values that are in the objects of the second form.
ex;
Dim findEntry As New frmSearch
findEntry.ShowDialog() 'Form is shown. Used to set variables for search
If findEntry.DialogResult <> DialogResult.Abort Then ' Do search when true, = Abort when cancel btn clicked
sSearchText = findEntry.txtSearchText.Text
sSearchItem = CStr(findEntry.cboItems.SelectedItem)
findEntry.Close()
sSearch is a variable which is assigned the value from the second form.
Last step is to close the second form.
|
|
|
|
|
Do you mean values to be return from a form where you put values, then when you close will return a value to be available at the next form?
Please elaborate what particular return values you want, I may help you about this matter..
|
|
|
|
|
One of the features that I really like about Visual Basic .NET is the ability to declare ReadOnly arrays of value types. However, use of this feature can cause Visual Basic .NET to emit an invalid assembly.
To demonstrate what I'm talking about, let's construct a simple lookup table. The table in question maps integers to doubles and strings, never changes, and does not have an available formula to allow calculations.
Because the LUT needs to be available from launch, a ReadOnly array is created.
<br />
Public Structure LUTItem<br />
Dim D As Double<br />
Dim S As String<br />
Sub New(DValue As Double, SValue As String)<br />
Me.D = DValue<br />
Me.S = SValue<br />
End Sub<br />
End Structure<br />
<br />
Public ReadOnly LUTS() As LUTItem = { _<br />
New LUTItem(0.03,"A number"), _<br />
New LUTItem(0.91,"Another number" }<br />
For small arrays, this works wonderfully. However, when you pass around 30,000 items in your array, two things happen:
1) Visual Studio .NET gets heinously slow after every change to the file as it recompiles the file.
2) When you build, the build is successful, but when you run, you are told that the assembly is not valid.
So, my question is this: why is there a disconnect here?
If this particular structure is invalid for the runtime, why does it compile without errors or warnings?
If this particular structure is valid for the runtime, why does the CLR call it an invalid assembly?
Note: I know that creating a massive LUT that way in the assembly is poor coding style. However, when porting software, it is often easier to do a straight port first, then enhance later. I encountered this porting a C++ library to VB.NET when I moved over a 48,000+ element array of structs used in the code that included function pointers and data to pass to the function pointers. Because it was a const array, I was trying to keep a similar access modifier in case any changes I made to the library inadvertently changed values in the array. Besides, who wants to create 48,000+ delegates while loading a file?
|
|
|
|
|
If all you have in this table is key and value pairs, why not implement it as a Dictionary using the DictionaryBase class? You can make your Dictionary ReadOnly and provide Insert Validation.
RageInTheMachine9532
|
|
|
|
|
The example was a simplified version of the actual port work. The example has problems after 30,000 entires, as does the actual port work, which has 11 seperate properties, including three delegates.
As for your recommendation, I do agree. That would be preferred were it possible.
However, there are strengths to using a ReadOnly array, namely compile-time array write checking rather than runtime checking, increased performance, and strong typing without a wrapper class.
But the main issue here is which is wrong: the compiler compiling code that should not run, or the CLR crashing on code that should?
|
|
|
|
|
Howdy,
I have a project that adds a dynamic context menu to Windows Explorer. I right click on any file and my menu items are displayed just fine.
However, when I right click a file in My Computer - no menu.
My registry settings appear to be just fine - they are the same as other context menu utilites.
I have restarted explorer.exe and even re-booted the computer
I am implementing CMF_EXPLORE in QueryContextMenu. Is there another interface I should be implementing in my code?
Any ideas why this works in Windows Explorer but not My Computer?
Thanks
- Brad
|
|
|
|
|
VB6:
Hi
in my user control code I want to pass the user control to a standard module sub but I'm having troubles with this :
'module : mdl.bas
Public Sub Add(ctrl As UserControl)
MsgBox ctrl.Width
End Sub
'MyCtrl.ctl
Private Sub Command1_Click()
Add Me
End Sub
I get this error : Type Mismatch because Me type is considered MyCtrl not userControl
then i tried this :
'module
Public Sub Add(ctrl As MyCtrl)
MsgBox ctrl.Width
End Sub
but i get : Method or data member not found ..
any way around this ?
|
|
|
|
|
On what line are you getting this error?
I'm guessing your getting on the 'Add Me' line. This would be because Add is not defined in your Control anywhere. You might want to try 'md1.Add Me'...
But, a better design would be for something outside the control to call the add function with a reference to the control.
RageInTheMachine9532
|
|
|
|
|
mdl.Add Me did not work when the Add method was defined as :
Public Function Add(ctrl as UserControl)
not specifying the module name (mdl) does not make the problem..
|
|
|
|
|
I didn't think it would, but it was worth a try...
The best method is still to have a piece of code outside your control add the control to your collection.
RageInTheMachine9532
|
|
|
|
|
Hi
i solved the (Sub not found) problem by exposing the user control properties using public properties.
thank you.
|
|
|
|
|
Is anyone familiar with using TTS with DirectSS? I was following an older tutorial on here, (http://www.codeproject.com/vbscript/texttospeech.asp), and like many of the other users pointed out, I am having trouble hearing any sound. I added the DirecSS component which is linked to the c:\windows\speech\XVoice.dll The program compiles, and there are no errors with the speech class. Vb recognizes:
spkSpeak.Speak("whatever")
and
spkSpeak.Speak(txtText.Text)
the second line there should speak what is typed in a text field named txtText. Any ideas as to why there is no sound?
I am using XP, and this tutorial was written before XP I believe, not sure if there is a compatability issue?
Thanks for any help!
|
|
|
|
|
Hi,
I couldn't find any information for the above topic, so I post it here.
I am trying to deactivate/disable the Floppy Disk Device under XP via Visual Basic. I already found out that it's not possible with WSH.
Is there any Api Function which allows me to disable the controller?
I need this to temporarily disable the Floppy to use the substitute Command to redirect the disk access to a directory. The SUBST command only works when a:\ isn't available!
Any suggestion to help me?
Thank you very much in advance for your replies.
Monivong
|
|
|
|
|
Hi,
I couldn't find any information for the above topic, so I post it here.
I am trying to deactivate/disable the Floppy Disk Device under XP via Visual Basic. I already found out that it's not possible with WSH.
Is there any Api Function which allows me to disable the controller?
I need this to temporarily disable the Floppy to use the substitute Command to redirect the disk access to a directory. The SUBST command only works when a:\ isn't available!
Any suggestion to help me?
Thank you very much in advance for your replies.
Monivong
|
|
|
|
|
You might want to try WMI and the System.Management namespace. You can get a reference to the disk controler driver and TRY to disable it, it works kind of like a service where you can Start, Stop, Pause,... But, if I remember right, it doesn't actually work properly with drivers.
But instead of going through all this pain, why not use B: instead of A:...
RageInTheMachine9532
|
|
|
|
|
Hello
Does anyone know if it's possible to create the description tooltip that appears in the IDE for properties and methods etc?
I know in C# you can embedd <SUMMARY> xml tags in the source, but this does not seem to work with VB.net?
|
|
|
|
|
That functionality isn't supported in VB.NET, yet...
To do this, you'll have to either write, by hand, the .xml file that describes the stuff, like c# can generate, or, you'll have to use a third party component that creates the file for you. You can find that on GotDotNet here[^].
RageInTheMachine9532
|
|
|
|
|
Hello,
I have a filled a data set and would like to insert data from that dataset to a different table then the dataset was filled with, is there a way to do it a row at a time? If so does anyone have an example?
Thank you,
Santana
|
|
|
|
|
Would you elaborate more?
If I am correct, then this is what you want to happen:
dataadapter.fill(dataset,"Table1")
'do inserts into the dataset
'now you want all the inserted rows to be saved to Table2! True?
'If you are using update command on dataadapter, then you would be able to only save the rows to Table1
dataadapter.update(dataset) 'this will save rows to Table1
if you want these rows to be saved into another table (Table2) then create another dataadapter + dataset for that table, copy dataset1 to dataset2 and then call update on dataadapter2.
let me know.
Web reading made easy -
http://www.xemantex.com
|
|
|
|
|
You can use a command object to update the rows in Dataset to the second Table in database.
'assume connString = Your connection string
Dim cn as new OledbConnection(connString)
Dim cmd as new OledbCommand
cmd.Connection = cn
cn.Open
dim i as integer
For i=0 to DataSet1.Tables(0).Rows.Count-1
cmd.CommandText = "INSERT INTO Table2 (Col1,Col2,Col3,..) VALUES (DataSet1.Tables(0).Rows(i).Item(1),DataSet1.Tables(0).Rows(i).Item(2),DataSet1.Tables(0).Rows(i).Item(3)....)
cmd.ExecuteNonQuery
Next
cn.Close
cmd.Dispose
cn.Dispose
"I think there is a world market for maybe 5 computers"
Thomas Watson, chairman of IBM, 1943
"There is no reason anyone would want a computer in their home"
Ken Olson, chairman & founder of Digital equipment, 1977
"This 'telephone' has too many shortcomings to be seriously considered as a means of communication. The device is ingerently of no value to us."
Western Union internal memo, 1876
"640 K ought to be enough for anybody."
Bill Gates, 1981
"Computers in the future may
|
|
|
|
|
try executing an SQL command using a command object.
loop through the records in the dataset
dim x as integer
dim KKK as new oledbcommand
kkk.connection = 'write you connection here
kkk.connection.open ' if the connection is closed
for x = 0 to dataset1.tables.rows.count - 1
kkk.executenonquery("Insert into TABLENAME (field1,field2,field3) values (" & dataset1.tables(x)("field1") & "," & dataset1.tables(x)("field2") & "," & dataset1.tables(x)("field3") & ")")
next
kkk.conection.close ' just close the connection
- Casting More!!
May elune shine upon you!
|
|
|
|
|
Hi,
I'd like to create my own PDF writer in .net.
Can anyone suggest me on
-> Where to start ?
-> Tecnologies involved ?
-> Where to get samples ?
-> How to get sample source code for Pdf components ?
Pls. detail me if anyone knows abt this.
Thanks in advance.
DHARMA.R
|
|
|
|
|
The first place to start would be http://developer.adobe.com. You'll need the specifications for the format of a .PDF file. Warning: Not free...
You can look at a couple of open source projects at http://sourceforge.net[^] like PDFCreator and iText.
RageInTheMachine9532
|
|
|
|
|
Hi Dave,
Thank u v much for ur valuable help.
I will check it now.
Thanks
DHARMA.R
DHARMA.R
|
|
|
|
|
Hi , i'm a new pwerson in this forum so please give me some lessons ok..;) Here i've got some problem that i want to learn the ant algorithm, not genetic algorithm using visual basic 6. As a student, i thought this ant algorithm is very interesting to me. So does anybody in this forum can teach me about the ant algorithm using visual basic?? How it's work?? Some example?? I hope that someone can teach me ok...
Thanks.
|
|
|
|