|
A translation of that code isn't really sufficient. You should clean up the code in the process.
nelsonpaixao wrote: CType(objForm, Form1).Label2.Text = TextBox1.Text
Why isn't the variable objForm of the type Form1 ? The only reason that you need a cast is that the variable is of the wrong type.
nelsonpaixao wrote: Dim MyForm As New Form2()
MyForm.objForm = Me
Don't expose objForm publically, send the reference in the constructor instead.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi, Guffa
The code is not mine, don´t ask me!!! I don´t understand it!!!
Thanks
|
|
|
|
|
Then why not try to find some better code to start from, perhaps even something in the language that you are using. What the code is doing is not very complicated at all, if you search the web for what you are trying to do, you should find several examples.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
private void Button1_Click(object sender, System.EventArgs e)
{
((Form1)objForm).Label2.Text = TextBox1.Text;
}
private void Button1_Click(object sender, System.EventArgs e)
{
Form2 MyForm = new Form2();
MyForm.objForm = this;
MyForm.SetBounds(400, 400, 300, 300);
MyForm.Show();
}
public string Form2Value
{
get
{
return MyVal;
}
set
{
MyVal = value;
}
}
David Anton
http://www.tangiblesoftwaresolutions.com
C++ to C# Converter
C++ to VB Converter
C++ to Java Converter
VB & C# to Java Converter
Java to VB & C# Converter
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB, C#, or Java to C++/CLI
|
|
|
|
|
I am attempting to display a splash screen and delay the main form load by following the Microsoft instructions and am getting nowhere. I can always MAKE it work by treating the Splash Screen as the startup form and opening the main form from there but I would like to get the instructions that I found to work since it is supposed to be SOOOOOO simple.
I have tried the code listed on MSDN[^] for this and it doesnt work like it is described. I found a thread on another forum that said to put the code in the Sub New of the Splash Screen code instead of the application code.
Note, this is a 2.0 project that I set to compile in 3.5 in Visual Studio 2008. I dont know if that has something to do with the Splash Screen issue or not.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
I was going to check out that MSDN code but your link is to CodeProject. Got the link?
|
|
|
|
|
|
Thanks. I added a splash screen and a form to my project, set the splash screen in the project's properties, and added the following code to the ApplicationEvents.vb:
Protected Overrides Function OnInitialize(ByVal commandLineArgs As _
System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean
Me.MinimumSplashScreenDisplayTime = 5000
Return MyBase.OnInitialize(commandLineArgs)
End Function
And it worked correctly. The splash screen was shown for 5 seconds. I targed .Net 3.5, too. I'm sure this isn't helpful but I just wanted to confirm for you that the code on that MSDN page did work so you might want to double-check your code.
|
|
|
|
|
Hi
How can i convert hashcode in string
Like this hashcode
-694847
Any idea would be appreciated
Thanks
Unless u don't give ur hundred percent whatever u r doning till there is no result of ur work...
|
|
|
|
|
~V~ wrote: convert hashcode in string
isn't possible
you can only hash as string and compare it to the hascode you have
|
|
|
|
|
The ToString method will turn -694847 into "-694847".
If you mean that the hash code is created from a string, and you want that string back, that's not possible. There is nearly an infinite number of strings sharing the same hash code.
For fun, I tried to calculate the number of possible strings sharing the same hash code, but the calculator in windows can't handle numbers nearly that big...
Despite everything, the person most likely to be fooling you next is yourself.
modified on Friday, July 18, 2008 1:55 PM
|
|
|
|
|
Thanks to both of U for ur information
Unless u don't give ur hundred percent whatever u r doning till there is no result of ur work...
|
|
|
|
|
~V~ wrote: Unless u don't give ur hundred percent whatever u r doning till there is no result of ur work...
A good ambition, but not something that you can count on.
(And somewhat ironic that you don't make the effort to write out words like "you", "your" and "are"... )
You should know that no programmer ever delivers 100% all of the time. You always make mistakes from time to time, so you should write the code in a way so that the compiler catches most of the mistakes, and so that you get proper error messages when anything goes wrong.
You should generally strive to make your code as simple as possible, not as clever as possible. Consider one of my favorite quotes:
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."
- Brian W. Kernighan
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: doning
He might want to check his spelling too
Guffa wrote: somewhat ironic that you don't make the effort to write out words like "you", "your" and "are"
That's funny. I found the not spelling it out rather annoying. Fighting the urge to down vote him just for that.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Nice quote, and very fitting
|
|
|
|
|
Hi Guffa,
It doesn't matter if you don't like my quote
Everybody should be aggree with me its not compulsory
And bytheway
you worte
You should know that no programmer ever delivers 100% all of the time
And somewhat ironic that you don't make the effort to write out words like "you", "your" and "are"...
I used U,Ur,R because its a new style to write the quote not the vb.net code where we have to write correct word
But My 100% means your 100% effort not the 100% time
Anyways thanks once again for answered my question
Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...
modified on Saturday, July 19, 2008 7:45 AM
|
|
|
|
|
I have an XL Macro that does mostly what I need, but I want to print just two sheets, one called "Purchase Order" and one called "Delivery Schedule".
I think I need something like ...
Sheets(Array("Purchase Order", "Delivery Schedule")).Select
Print.Selection
But I am having probs
I am not very good at vba,where am I going wrong, as this is not working!
I suspect I am not creating the Printer as an object and I don't know enough about how to do this
Can anyone help?
------------------------------------
"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
|
|
|
|
|
Try this:
Sheets("Purchase Order").Printout
Sheets("Delivery Schedule").Printout
The sheets will print to the current default printer.
To change the printer on-the-fly, use:
Application.ActivePrinter = <queue name="">
Hope that helps!
Tim
|
|
|
|
|
Thanks, That Solved it!
I have been looking so closely at getting the dataset right that I forgot how to print!
Thanks also for the Application.ActivePrinter Line! I will incorporate that once I get the barebones working.
just to let you know, this is my FIRST ever SOLO project, all alone, no help except for this question, and I am learning LOADS.
------------------------------------
"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
|
|
|
|
|
No problem...
We have environmental graphs that are maintained in Excel and printed weekly. Since I maintain the code, I knew where to look.
When we share our wealth of knowledge, we all have the opportunity to grow.
Tim
|
|
|
|
|
hi,
i open a form as showdialog as following to get input
If frmFindVehicle.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
txtNumber.Text = frmFindVehicle.ReturnNumber
End If
frmFindVehicle.Dispose()
and coding of Ok Dialog result button of form(frmFindVehicle) is following
If dgvModelList.SelectedRows.Count = 0 Then
mdChecking.Prompt("Please select Model from grid")
Exit Sub
ElseIf dgvModelList.SelectedRows(0).Cells(9).Value = Nothing Then
Exit Sub
End If
ReturnNumber = dgvModelList.SelectedRows(0).Cells(1).Value
my problem is that when ok button is pressed and No row is selected then form(frmFindVehicle) must be open and force user to select a row. In above case it simply prompt the message and return back to main form.
|
|
|
|
|
i'm assuming at design time your assigning the dialogresult.ok to the ok button. Don't do that. In the click events of the ok and cancel set the result there.
Ex:
private sub cmdOK_Click(sender as object, e as system.eventargs) handles cmdOK.click
.
.
.
'do your checking and get out if failed...
me.dialogresult = windows.forms.dialogresult.ok
close
end sub
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
Thanks , its work.
Also nice quote which is in bottom part of your message
|
|
|
|
|
Hi,
alternatively you could perform the checks in the FormClosing event, setting
FormClosingEventArgs.Cancel if necessary; and possibly reading FormClosingEventArgs.CloseReason
|
|
|
|
|
Also check that your form does not have an accept button assigned (caters for enter being pressed on the form, cancel suports esc) as this will automatically do the dialog result assignment.
I have been in the position of having to delete a button that has been assigned to the AcceptButton on a form and recreate it with a different name to get rid of the assignment. Therefore I have a mix of btnSave and btnOk in my apps - very irritating.
Never underestimate the power of human stupidity
RAH
|
|
|
|