|
In my project i have to show a form using a string variable, that means
the form name is available in a string variable like,
strFormToShow = "Form2" and form2 is available in my project. How can i
show this form2 using this string variable ?
pls help me, urgent
regards
ajo
|
|
|
|
|
First rethink your pbolem. Is this really the way you would like to open forms? I smell a bad design
But anways, look at Reflection, that should be the solution for your problem.
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
I agree with CWIZO. There's NEVER a reason to tie data directly to the names of objects in your code. This reeks of a bad design waiting to explode in your face.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi. Does anyboy know how to make a plug-in with vb.net that works on browsers , like Yahoo! toolbar , Google toolbar ,.....
plesae help me!
|
|
|
|
|
Can somebody please send me the steps to do the crystal reports
Thank You
Pankaj Garg
|
|
|
|
|
You'll have to be a LOT more specific than that. You're just asked a question akin to something like, "Can someone please send me all the steps for driving a car?"
Crystal Reports docs on MSDN[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
What is the difference between byval and byref?
What is the difference b/w c# and vb.net?
Thank You
Pankaj Garg
-- modified at 3:34 Sunday 23rd April, 2006
|
|
|
|
|
pankajgarg12 wrote: What is the difference between byval and byref?
Passing a variable to a Procedure or Function ByVal means that the actual value of the variable is placed on the stack. If you pass it ByRef, only a reference (i.e. pointer) to the variable will be placed on the stack.
A ByRef will allow the called function to modify the actual source variable. A ByVal call never touches the original variable.
Depending on the size of the variable and/or its purpose, you can use either in your own code. If you have a large array for example, it would be better to pass it as ByRef so that you don't put too much information on the stack.
pankajgarg12 wrote: What is the difference b/w c# and vb.net?
They are both programming languages. VB.NET's ancestor is Visual Basic, C#'s ancestry is from C and C++. Use whichever you are most familiar and comfortable.
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
Thanks for pointing out that passing by reference when you are dealing with large amounts of data is the way to go. I am going back to school after many years and the instructor said that passing by value is faster and more efficient. I do not want to tell the instructor (masters degree) that he does not know what he is talking about (grades are on the line), but that is a fact.
By the way, I am going back to school because 15 years of experience does not qualify me to teach.
INTP
“Testing can show the presence of errors, but not their absence.”
Edsger Dijkstra
|
|
|
|
|
John R. Shaw wrote: the instructor said that passing by value is faster and more efficient.
Well yes - it depends on the nature of the data that you are processing. For small data (e.g. a single Integer) then passing ByVal is fine. An array of 100 Integers or a 128kB image is a bit too much.
One thing to keep in mind is that a ByVal parameter actually causes a COPY of that variable (Integer, Array, String etc...) to be made and placed onto the stack. A ByRef creates a pointer to the ORIGINAL variable so only one exists - and that's why ByRef variables can be modified by called functions, so you must be aware of this desired (or undesired) behaviour. It can cause program errors.
As an aside - ByVal variables can also be modified by the called function, but you are only modifying the copy and not the original so any changes are lost when the function returns to its caller.
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
Thanks for the well written reply. I did not mean to give the impression that I did not know this already, just that the instructor made a blanket statement that is not always true.
I have been writting software for many years and prefer C++, but I do not have a degree. The class I just finished taking yesterday was on programming in VB.Net. I expect my total score to be 993 out of a possible 1000, do to a minor disagreement with the instructor.
INTP
“Testing can show the presence of errors, but not their absence.”
Edsger Dijkstra
|
|
|
|
|
I need to get a list of first and last names from a database. These names are together in one column and need to be split into two seperate columns. I can get the names from the database and I put them into a dataset. I can't figure out how to seperate the names so I can put them in seperate columns. Can anyone help? Thanks
|
|
|
|
|
Depends whether or not you want to do the manipulation in the database engine or VB. If the former you can write a TSQL query like this:
select FullName,
substring(fullName, x, n) as FirstName,
substring(fullName, y, m) as LastName
from ....
where the substring() function extracts the names from the FullName column. These will then be presented to your program as columns returned from the query.
If on the other hand you want to do the manipulation in your program, use the Split() function on the FullName column (e.g. if FullName contains "Bloggs, Joe" the following code will extract these into the names array...
Dim names() as String<br />
names = Split(FullName, ", ")<br />
<br />
'names(0) will contain "Bloggs"<br />
'names(1) will contain "Joe"
Hope that helps.
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
Okay I have a windows form with a menu on it and i want the menu 2 b on the same layer as the form. When I put the menu control on the form it displays it as if it is sunk into the form. Does anyone know how to change that?
Da Intern
|
|
|
|
|
Visual problems are difficult to diagnose in forums, becaused, obviously, we can't see what you mean by "on the same layer".
Did you set the FormBorderStyle to Fixed3D? Is the menu sitting in another container that is set for rendering Sunken or 3D?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi everyone!
Actually, I have two questions:
First: How can I change(in code) , in a VB report the properties of a shape (i.e. a square)? I have a form with check marks and I wish that, when a check mark is checked in an after report a square shape should become red and when unchecked the square should be unfilled.
Second: How can I, in a image toolbar, change the enable/disable property of an icon?
Thanks in advanced!
|
|
|
|
|
I want to use a button to change to another form, how do you call the other form?
|
|
|
|
|
You make a new instance of the second form (ore use an existing one) and call it's Show or ShowDialog method.
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Dim myForm As New MySecondForm
myForm.Show()
' or
Dim result as DialogResult
result = MyForm.ShowDialog()
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
use the following command on the click event of the button
formname.show
formname is the name of the form you want to open
|
|
|
|
|
please help me
why dont work it code?
i need explication of why this dont work
<br />
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long<br />
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long<br />
Private Declare Function CreateThread Lib "kernel32" (lpThreadAttributes As Long, ByVal dwStackSize As Long, lpStartAddress As Long, lpParameter As Any, ByVal dwCreationFlags As Long, lpThreadId As Long) As Long<br />
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long<br />
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long<br />
Private Declare Function GetExitCodeThread Lib "kernel32" (ByVal hThread As Long, lpExitCode As Long) As Long<br />
Private Const INFINITE = &HFFFF ' Tiempo de espera infinito<br />
<br />
Private Sub Command1_Click()<br />
Dim var1 As Long, var2 As Long, var3 As Long, var4 As Long<br />
var1 = GetModuleHandle("msvbvm60.dll")<br />
var2 = GetProcAddress(var1, "rtcShell")<br />
If var2 <= 0 Then MsgBox "funcion no encontrada": Exit Sub<br />
var3 = CreateThread(ByVal 0&, 0&, ByVal var2, ByVal "notepad", 0&, ByVal 0&)<br />
Call WaitForSingleObject(var3, INFINITE)<br />
Call GetExitCodeThread(var3, var4)<br />
If var3 <= 0 Or var4 <= 0 Then<br />
MsgBox "POR QUE DIABLOS NO FUNCIONA ESTA PINGADA"<br />
End If<br />
CloseHandle var3<br />
End Sub
EOF
|
|
|
|
|
What do you want this code to do first? Just saying "why does this not work?" Doesn't help because we don't know what your want it to do.
It LOOKS like you're trying to launch Notepad on a seperate thread. If so, you're going about it the VERY hard way. All you need to do is:
Shell "Notepad"
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I've loaded gif image into Image object. Could you please give me an advice how to change frame delas? As someone is interested, I get them as follows:
Dim PropertyTagFrameDelay As Integer = &H5100
Dim propItem As System.Drawing.Imaging.PropertyItem = img.GetPropertyItem(PropertyTagFrameDelay)
Dim bytes() As Byte = propItem.Value
Dim delays(frame_cnt) As Integer
Dim i As Integer
For i = 0 To frame_cnt - 1
delays(i) = BitConverter.ToInt32(bytes, i * 4)
Next
Thanks,
Alex
|
|
|
|
|
Hi all, I want to write a string matching program that using boolean operator(AND,OR), can you give me an idea how to use that operator? Thank you.
|
|
|
|
|
You'll have to explain this a bit more. AND and OR are boolean operators and don't work if you put them between strings. You can't do:
If string1 And string2 Then
....
So what do you want to do with these strings?? How do you want to compare them?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|