|
keroed_edmond wrote: i know this is a c# forum but couldn't find one vb.
The Code Project discussion boards - Visual Basic / VB.NET[^]
Regarding your actual question, the HttpWebRequest class may what you're looking for.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
|
I can think of one thing right away that you should check.
i assume that this button you want to click, that isn't doing anything even though you have an action written for it, is not "wired" to the event.
Here, select the button in the gui designer and go to its properties. then click the little lightning bolt in the propertygrid and goto its events... Now... if you see an empty box to the right of the "Click" event... then my guess is right and the event is not wired. Click inside that empty box, and a combobox-dropdown button should appear...hit it and, select "button1_Click" from the list. now it should work
sometimes this happens when you paste stuff from other forms or something...
|
|
|
|
|
No, the event of Click was already on button1_Click it didn't work.
SnaidiS(Semion)
|
|
|
|
|
hmm...then it's probably a logic bug in your code or that control or somewhere between.
did you try setting a breakpoint and stepping into it?
I'm not sure if you know this or not. you click in the margin to the left of this line "private void button1_Click(" and get a little red circle to appear...the breakpoint... then do debug -> start. and when you click the button, the code should run to that line.. then do debug -> "step into" and line after line see what gets executed and what doesn't.
if you cant figure it out...you can send me you test project and i can try to find the problem. i know you posted the code, but i'm a bit lazy to recreate your project...and maybe theirs something not in the code thats messing it up :P
|
|
|
|
|
I tried to debug it and when I click the button it makes the function but I dont see the results on screan..
OK, I'll upload the project.
Here is the project.
http://fileho.com/download/e95cc0167872/Graphics.rar.html[^]
and listen If you have problem with the Graph Control so the dll is on the folder.
Thanks
SnaidiS(Semion)
|
|
|
|
|
my email is the username i use here @gmail... :P
|
|
|
|
|
|
ok i figured it out :P
zgc.Invalidate();
add that to the end of your createGraph function.
it tells that control that it needs to be invalidated cause its data was changed. its really the control makers fault here... they should of done that automatically when the data is changed :P
if you ever get problems...
zgc.Refresh(); this can do it and force the repaint to happen right away, but i think it might be slower... its better with invalidate :P
their are other things like
zgc.SuspendLayout()
make lots of changes to the control
zgc.ResumeLayout()
if you encounter lots of flickering or whatnot ... these functions exist in all controls that inherit system.control or system.usercontrol fyi ...like if you ever get this problem in the future :P
i was tipped off to the problem when while stepping through with the debugger that i saw the button working properly... and it was because the whole form was getting invalidated cause of the debugger kept on moving ontop of the window with each refresh..or something...
|
|
|
|
|
Thanks! It works now, you are great!
May the world be full with people like you
Thanks !
SnaidiS(Semion)
|
|
|
|
|
Glad it worked
|
|
|
|
|
Hello. I am trying to get a program to insert the date at where current text is being typed (not explained very well, I mean the little line when you type name is on the tip of my tongue...). At first I tried to get it to appear using the following code
<br />
rchTextCode = rchTextCode.txt + DateTime.Today;<br />
But it only added it at the end of the text
I am sure I am doing something really obviously wrong, any help? <
|
|
|
|
|
Try the following:
textBox1.Text = textBox1.Text.Insert(textBox1.SelectionStart, DateTime.Today.ToString());
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hey guys, I just wanted to get some input on this method I wrote to parse data. Normally every time you want to parse data coming from a datasource, we need to do something like:
int myInt = 0;<br />
try<br />
{<br />
myInt = (int)ds["columnName"];<br />
}<br />
catch{}<br />
<br />
bool myBool = false;<br />
try<br />
{<br />
(bool)ds["columnName"];<br />
}<br />
catch{}<br />
etc....
This is of course gets very ugly the more data you are grabbing. Initially in c# 1.1 I had written a class with a bunch of methods for each variable type. So for the int example above I would use:
public int ParseInt( string sValue, int defaultValue )<br />
{<br />
try<br />
{<br />
return int.Parse( sValue );<br />
}<br />
catch<br />
{<br />
return defaultValue;<br />
}<br />
}
As well as an overloaded method
public int ParseInt( string sValue )<br />
{<br />
return ParseInt( sValue, 0 );<br />
}
So the above example would now look like:
<br />
int myInt = ParseInt( ds["columnName"].ToString() );<br />
bool myBool = ParseBool( ds["columnName"].ToString() );<br />
For the record, I realize this was not a good solution, as the .ToString() method would throw an exception if ds["columnName"] was null. I should have had the methods take an object as the argument, and try (int)object inside the method instead of int.Parse(). Regardless, this worked well but you needed to write 2 methods for each variable type. With the release of c# 2.0 and generics, I decided to make a more flexible version. I came up with the following 2 methods that will handle any variable type.
<br />
public static T Parse<T>( object objToParse, T defaultValue )<br />
{<br />
try<br />
{<br />
return (T)Convert.ChangeType( objToParse, typeof( T ) );<br />
}<br />
catch<br />
{<br />
return defaultValue;<br />
}<br />
}
And the overloaded method
public static T Parse<T>( object objToParse )<br />
{<br />
return Parse<T>( objToParse, default( T ) );<br />
}
So now my above examples become:
int myInt = Parse<int>( ds["columnName"] );<br />
bool myBool = Parse<bool>( ds["columnName"] );
MUCH cleaner than before, and you can pass it any type of object. This seems to be a perfect solution, but I am posting to see if anybody sees anything wrong with this. We are using this method pretty heavy now @ my current job, and I just want to be sure I haven't overlooked anything. Thanks for the help.
|
|
|
|
|
This is .NET code? So there is some reason you cannot use Typed DataSets?
led mike
|
|
|
|
|
Well this can be used in places where Typed Datasets would not make sense; form inputs for example. Also we use a lot of DataReaders as opposed to DataSets, so it makes sense to use something more universal.
|
|
|
|
|
Let's say i want to make a proxy tester/IP scanner/website checker or whatever, how can i check if the server/ip/domain exists? i tried using ping but i couldnt find relevant references.
help would be appreciated.
|
|
|
|
|
Many servers and firewalls have ping disabled.
If you want to check if a web site is up, you should request a page from it. Just checking that the server is running does not guarantee that the web server is running or that the web site is working.
---
single minded; short sighted; long gone;
|
|
|
|
|
Well, how do i do that then? o_O
|
|
|
|
|
There's really no reliable way to verify it at all, except for just trying it and see what happens.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
You can use the WebRequest class or the WebClient class.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hello gurus,
I'd like to know how I can enumerate the SQL Server instances on the local machine?
How can do this in C#?
For example, if I have installed the default instance, an the instance named "TOTO" on my system, I wish to see the two names in my enumaration (local and TOTO).
Best regards.
Fred.
Note: the sample in VS 7.1 that uses ODBC does not work with SQL Server 2005 and VS2005.
There is no spoon.
|
|
|
|
|
|
I was talking about this sample. it does not work on VS 2005 & SQL Server 2005...
There is no spoon.
|
|
|
|
|
Did you try to convert project for VS2005?
|
|
|
|