|
The designer files are just code to create the form and it's controls and lay them out on the form. Why would you want to execute just that file?? To answer you're question, no, you can't execute just the code in that file. All the files for the form are compiled into a single object that has no idea it was created from multiple files.
|
|
|
|
|
He said "exclude", not "execute". (Or maybe he edited the post.)
|
|
|
|
|
Hi,
1. when you create another kind of project (say a Console app) you wouldn't get a designer file at all; you then can edit and add Windows.Forms code (or any other code) to the files you do get. That excludes designer support of course.
Also, you can copy-paste the designer code from where it is to where you prefer it to be, then remove the designer file. The designer may or may not still work for you then (I do it sometimes in C#, I have no experience doing this in VB.NET).
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Luc Pattyn wrote: Also, you can copy-paste the designer code from where it is to where you prefer it to be, then remove the designer file. The designer may or may not still work for you then (I do it sometimes in C#, I have no experience doing this in VB.NET).
The last time I tried this, it broke the designer. Though, I can't rememer if it was VS2003 or VS2005.
|
|
|
|
|
Hi Dave,
I just finished this[^] test app using VS C# 2008 Express; with the InitializeComponent() stuff inside the main file, all works well, the designer locates and keeps updating its code just like older VS versions used to do.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Cool. I never tried in in 2008. I don't have it installed anywhere at work yet.
|
|
|
|
|
Interesting!
I spend a fair amount of time doing the opposite, converting .Net 1.0/1.1 code to have a designer.cs file, since I prefer that.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
So did I, when switching away from older .NET and VS versions.
However for very small projects (less than 100 lines of code) I prefer having it all in 1 file.
BTW: this may interest you, long ago, working in Fortran under RSX11D/RSX11M/old versions of VMS, I used to put build commands at the top of my FTN sources, starting with a 'C' of course; and I had a small utility to invoke compiler, linker, and then run the program. So the entire project was 1 file, which built and ran automatically.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I created an application in vb.net 2005. It works fine on my machine. I tested several different test machines and all were working fine. As for the client, it's generating an error. My application reads from an excel sheet and imports the values to an oracle database. the error being generated is: "conversion from type string to type double is not valid". Why is it generating on on the client's computer and not mine?
|
|
|
|
|
Hi,
if an app runs fine on one machine and not on the other, it is because there is at least one bug in the app; it could be something was looked over, in your case maybe the system (or Excel itself) was used with different regional settings, resulting in a different character choice for "decimal point" and "group separator" (or "thousands separator").
For apps that need to work together, you have to impose similar working conditions; so either they all should follow a fixed standard, or they all should obey the regional settings, or they all should be configurable and get the same configuration settings.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
It's most likely a problem with Culture settings. On the two PCs you probably have different characters as decimal separators.
Have a look at CultureInfo[^], it provides an InvariantCulture[^] property that lets you build culture-insensitive apps, as well as several properties which expose the host machine's culture settings.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Hello every one please help me i have 50,000 rows in database i retrieve my data and then assign to datagridview like datagridview.datasource=dataset.table(0)
but it take 10 sec for showing me record there is no event behind datagridview
why binding is taking so much time is there any alternative option autogeneratedcolumn property is true
|
|
|
|
|
H.A.Faheem wrote: why binding is taking so much time
Because you're retrieving and throwing 50,000 records at the grid. Does the user really DO anything with all 50,000 records, or do thye just need to see and use a subset of those records. Limiting the number of records that you retrieve and display is about your only really effective alternative...
|
|
|
|
|
Hi,
i was wondering if there is a way to control the HID of a mouse or keyboard (the xp default one)
by using SendMessage or anything like it....
im trying to send keystrokes and mouse movments to a game im playing
but the developers have blocked the ability to hook into the game and send it commands...
im using vb .net
Thanks.
|
|
|
|
|
Kobi_Z wrote: is a way to control the HID of a mouse or keyboard (the xp default one)
by using SendMessage or anything like it....
Nope. DeviceIoControl[^] is about the only way you're going to send a message to the driver, but you can't tell it to generate a keystroke.
Kobi_Z wrote: the developers have blocked the ability to hook into the game and send it commands...
Imagine that. I'm guessing that there's a really good reason they did that.
|
|
|
|
|
A typical reply of yours...
the developer is using GameGuard to prevent hackers from sending duplicated packets to the game
or injecting dlls and destroying it for other users, .
im looking for a way to keep up with my guild mates while im at work
so im trying to make a bot which will do one simple things for me in the game,
it might be a bit of cheating but definitly not hacking.
currently im using a "smart" joypad for that (most players do)
and i wanted to make something smarter.
thanks for your reply anyway.
|
|
|
|
|
The developers also put that stuff in to prevent "gold mining". Which is the automated, repeated tasks that get you money in the game. The 'bot sits there and punches keys all day, "mining" the gold for you, while you go to work and have your "normal" life.
Personally, I don't care whether the motivation for doing this is ligit or not, and guess what, neither do the developers of the game.
|
|
|
|
|
I have a sorted list that stores current values of 3 different data types. I also have a hash table that holds the previous value of each data point. I need to compare the newest value to the previous value and store any ones that change to a list. This has been working fine for months but a new requirement was added making some of the values = nothing and this is where my problems began
Previous code
For each de as DictionaryEntry in serialData
name = de.Key.Tostring
If ValueChanged(de.Value, hash.Item(name),de.value.GetType.Name = 1 Then
... add new value to list
... replace value is hash table with new value
End If
Public Function ValueChanged(Byval val1 as Object, ByVal val2 as Object, ByVal typ as String) as Int16
Select Case typ
Case "Single"
Dim newVal, lastVal as Single
newVal = val1
lastVal = val2
If Not newVal = lastVal then
Return 1
Else
Return 0
End If
Case "UInt32"
.... same
Case "Int32"
.... same
End Select
For the new requirement, I added a If val1 = Nothing Then Return 1 but now this line returns true when val2 = 0.0 making the function return 1 which I dont want. 0.0 should not be equal to nothing. I also tried using Nullable types
Public shared Function HasChanged(ByVal val1 as Single, ByVal val2 as Nullable(Of Single)) As Int16
If val2.HasValue Then
If val1 = val2 Then
Return 0
Else
Return 1
End if
Else
Return 1
End if
Public shared Function HasChanged(ByVal val1 as Single, ByVal val2 as Nullable(Of Int32)) As Int16
If val2.HasValue Then
If val1 = val2 Then
Return 0
Else
Return 1
End if
Else
Return 1
End if
Public shared Function HasChanged(ByVal val1 as Single, ByVal val2 as Nullable(Of UInt32)) As Int16
If val2.HasValue Then
If val1 = val2 Then
Return 0
Else
Return 1
End if
Else
Return 1
End if
but this increases my CPU from 3% to 56%! Any idea what I could be doing wrong. I am in a time crunch
|
|
|
|
|
Hi,
nullable types don't come for free, they take more memory and more cycles, as they have to store and process the data that goes with the extra functionality (think of it as one extra boolean flag "hasValue",
it would double the footprint of an int, double the amount of data to be copied when performing nullable int=nullable int, etc).
you may have to account for changes in "hasValue" too; i.e. a variable that goes from "hasNoValue" to "hasValue" has definitely changed (and if you allow the reverse change, from "hasValue" to "hasNoValue", that would be a change too). So your history information should not be just "oldValue" but also "oldHasValue". Hence
Public shared Function HasChanged(ByVal val1 as Single, ByVal val2 as Nullable(Of Int32)) As Int16
IMO should be more like (I'm no VB expert!):
Public shared Function HasChanged(ByVal val1 as Nullable(Of Int32), ByVal val2 as Nullable(Of Int32)) As Bool
if val1.HasValue AND val2.HasValue return val1<>val2 ' value changed
if val1.HasValue <> val2.HasValue return True ' hasValue changed
return False ' was and is without value
End Function
Some more remarks:
1. Try to avoid ToString. if Key is already a string, no need to call ToString on it.
2. I'm not sure having two different collections (one of them a HashTable/Dictionary) is wise; I would try and figure a way with just one. More in particular, if current value and previous value is a characteristic of your objects, I would incorporate that in the object itself, not delegate it to some HashTable. A simple For Each would then suffice.
3. While doing (2) I would not use nullable types, instead I would add an explicit bool flag to my objects. As I expect my code would be more efficient than the general-purpose nullable support (see first alinea).
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
modified on Wednesday, August 12, 2009 2:34 PM
|
|
|
|
|
Thanks for your response Luc,
I definitely get the increase now... I tried your update and while it does make unfortunately I am running on a very limited processor and cant afford a performance hit like that.
Thanks for your other remarks too, I can definitely see the your second point and will try to incorporate in the time i have left.
I appreciate the help
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Public shared Function HasChanged(ByVal val1 as Nullable(Of Int32), ByVal val2 as Nullable(Of Int32)) As Bool
if val1.HasValue AND val2.HasValue return val1<>val2
if val1.HasValue <> val2.HasValue return True
return False
End Function
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi Everyone,
I need a database project in Visual Basic with SQL Server 2005/2008. Can anyone provide me a sample projects/source code for this?
Thanks in Advance
Raj
|
|
|
|
|
Google is your friend and Bing is its buddy.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Why?? So you can pass a class you don't deserve to pass?? I don't think so...
|
|
|
|