|
No need to download anything, just they have to connect with my server & run my program.
ThankYou
|
|
|
|
|
And what sort of services does this server expose? Is it a file server, web server, SQL Server, ftp server, ... What does this server host that the clients need to connect to??
If your app is already installed on these remote clients and you need them to connect to a SQL Server on your end, you need to expose the SQL Server using different methods other than normal access. Exposing an SQL Server directly to the internet is as about as safe as dousing it in gasoline and lighting a match.
|
|
|
|
|
Hi all,
I am newbie in vb.net and I have a simply (I think) quenstion.
I have tree Pictures Boxes and I want when the user clicks the button the first time the PictureBox1 to be filled and when the user clicks for the second time the PictureBox2 to be filled and so on.
I have succeed to doing that using if statement and I was wondering if I could do that by using a loop.
Thank you in advance
|
|
|
|
|
You could, but why would you want to?
If the reason is that you want a lot more pictureboxes than just 3, then it will be easier to create and place a new picturebox each time the user clicks the button.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Why would you need a loop?
If you wanted to fill all three pictureboxes every time the button was clicked, a loop might be useful, but not for individual fills.
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.”
|
|
|
|
|
I was thinking to avoid to write the same thing three times.
For example I am imaging that it could like the following:
for (i=0, i<3, i++)
PictureBoxi.Image = CropBitmap(GetWindowPicture(PictureBox2.Handle.ToInt32), 100, 100, 50, 50)
so the first time the result would be
PictureBox1.Image = CropBitmap(GetWindowPicture(PictureBox2.Handle.ToInt32), 100, 100, 50, 50)
the second
PictureBox2.Image = CropBitmap(GetWindowPicture(PictureBox2.Handle.ToInt32), 100, 100, 50, 50)
and the third time
the second
PictureBox3.Image = CropBitmap(GetWindowPicture(PictureBox2.Handle.ToInt32), 100, 100, 50, 50)
May I accomplised that in VB.NET, to create the full name of the Picturebox using a variable?
|
|
|
|
|
athinaix wrote: to create the full name of the Picturebox using a variable
I'm afraid not.
You could put the pictureboxes into a collection and get at each like:
Dim activePicBox AS PictureBox = myPBCollection(i)
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.”
|
|
|
|
|
May be like this(in C#):
((PictureBox)(this.Controls["PictureBox"+i.ToString()]).Image
Not sure if doing things like these are recommended.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
I am looking to retrieve a value from an existing file and copy it to a new one, for the sake of a header. The value is a date. I am using a mix of old and new files, some have the information I need and it has to be copied to the new file, some older files don't and new data will need to be written in it's place to the header.
The question is, can I use ->
If ('Old Chicken' Is Nothing) Then
'Fill the freezer'
Else
'Put Old Chicken In New Freezer'
End If
Or would it be sesible/is it acceptable to ->
Try
'To put old chicken in new freezer'
Catch As Exception
'Call it quits and just fill the freezer'
End Try
Any help would be greatly appreciated.
|
|
|
|
|
The if/else approach. What if you get an exception in the try block? (Not because Old chicken is nothing but some other reason)
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Good good. I'm pretty new to programming and VB especially. I'm just worried that the if/else would just throw an error if the object I was trying to acquire did not exist at all and wasn't just empty. Thus the code would exit anyway, the try/catch would solve this. But yes, I take your point, if there was any other error in this snippet, it would be rather sidelined.
|
|
|
|
|
Best would be to use if/else inside try/catch.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
|
Maybe I should reword my question... All these answers are helpful (as a n00b anything that helps me learn is a good thing, so thanks).
But when I test for the is MyChicken = 'null' (or similar), I get a NullReferenceException. I'm guessing because the old files header does not include a reference to the 'Chicken' I seek, so it looks for the chicken doesn't find it and exits code, saying it's not there, not even bothering to check for it's 'nullness'.
I guess I mean...
If MyChicken is there at all
'Put it in the freezer'
Else
'Create a chicken and put in in the new freezer'
End If
If you'll excuse all the poultry references.
|
|
|
|
|
You're on the right track though.
The best way to go is to start of with the Try Catch block and MsgBox(ex.ToString) in the Catch clause. Turning on line numbers in your code editor is also a good idea.
Then when you get these NullReferenceExceptions, you'll know exactly which object is causing the error.
Next thing is combining checks, on separate lines, so that you always first check for Is Nothing, and only then for anything else like null or empty strings, etc.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thanks for the proTip. I'm testing the object key for 'is nothing', I figured it would be the best place to start, this is where I get the error, on the first line of said conditional (if null etc...).
I have since discovered .contains, useful. Having jumped from C++/C all these VB short cuts and lack of pointers is giving me much fun/joy/sarcasm. Thanks for all your help though guys, there are some good snippets there.
|
|
|
|
|
Depending upon how you are pulling the value before comparing it, you may be able to check for nulls with the following statement:
If myValue Is DBNull.Value Then
'Handle the Null value
Else
'Value was not null
End If
Hope this helps.
|
|
|
|
|
I try to translate code from c++ to vb6,
in C++ i have:
unsigned char a = 3
unsigned char b = 188
unsigned char c
c = a^b
I get an answer c = 191.
I try the same in VB6
dim a as byte
dim b as byte
dim c as byte
a = 3
b = 188
c = a^B
I get Overflow
How do i get the same result ?
i tryed using combinations with MOD 256 but no success.
thanks.
|
|
|
|
|
Well, your basic problem is that you're using VB6, which was always crap, and has been unsupported for a long time. Why are you still using it ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Well, it is an additional feature im adding to a program allready written in VB6.
the question is what would be easier, coverting the whole program to smth else
or just trying to fix my problem.
|
|
|
|
|
It depends. If the program is going to live for a long time, I'd consider converting it to a real language.
If all else fails, you can do what VB6 users always did, get a C++ dll to do the real work. I don't know why the operation you're trying is failing, I suspect the answer is that the ^ does something different in VB6 to c++.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
IIRC it does.
^ in C/C++ is Bitwise Exclusive Or
^ in VB6 is exponentiation (raise to power)
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
"^" in C++ is bitwise XOR while in VB, it is power(exponent). Maybe that is the reason you are getting error.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Yep, I eventually figured it out,
im not so familiar with c++...
thanks.
|
|
|
|
|
using VB6 is a real bad idea. Use some newer Versions as Vb.net.
Always remember VB6 code isnt portable to VB.net, so VB6 is lost.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|