|
My MSDN knows about PropertyGrid.BackgroundImageChanged and Form.BackgroundImageChanged
and I don't use PictureBox, to me it has no value whatsoever.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Dear guru's,
I have 2 questions.
1.
How can I load a html-page from i-net into a windows-form - is there any control available?
2.
If I have loaded that html-page: How can I parse it? e.g. to get any data out of a table in this html-page.
thank you very much for your hints ! ! !
|
|
|
|
|
Use WebBrowser control to load a webpage and show it in a windows form
To parse the html page use HtmlDocument class and play around... u can load the htmldocument by using
HtmlDocument doc = WebBrowser1.Document;
Koushik
|
|
|
|
|
Thank you for your fast reply ! ! !
|
|
|
|
|
And if you didn't want to show a webpage to a user, but still get the html to parse, you can use HttpWebRequest.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Thank you for your fast reply ! ! !
|
|
|
|
|
Hi to all,
I got a new question, managed to clean up the memory of an imagetool that was loaded at the client side as an activeX control.
I kept developping it and it now has basic selection (select, resize, crop etc.) as well as adding text, hue, contrast brightness etc.
There is though one thing missing and that would be a lasso tool or a free selection tool... I tried the codeproject, I tried google but no luck so thought I should ask the question in here
Anybody has an idea?
Thanks again
Cheers
its our widgets that make us men
|
|
|
|
|
That's a tool to select a freeform shape out of an image ? I've done that before, in C++. You can only create a bitmap that is square, you need to work out how to handle transparency in the unselected area of the square.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
One nice characteristic of Fortran (the language some people don't know the syntax of)
is it allows for spaces in identifiers. Unfortunately more modern languages don't...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Thanks to both for replying so quickly
Hmmm so if for example I try and find the maximum outer points of a selection
(btw any idea on how to draw such a selection? would ControlPaint allow a freehand selection? I'm using it to draw a square selection on the image but not sure it can handle a freehand one?)
then lets say I copy this square, keep the selection in mind and turn every pixel outside that selection to blank...
the problem would be how can I determine if the pixel is inside the selection?
What I did for the square selection is take the rectanle, find its coordinates in the picture and used the DrawImage with a source rectanle (knowing that the ControlPaint uses a rectanle to draw a reversible frame)
Lool sorry if I'm repeating myself a little through the post, try to imagine how I can find the pixel inside the selection... what is outside doesn't need to be transparent (lucky me the client doesn't want that)
its our widgets that make us men
|
|
|
|
|
Hi All,
How can i a new file (.exe) in new menu. means Right Click > New > MyFile will availbe with all other stuff.
Any idea ....
Thanks in advance !!!!
|
|
|
|
|
|
Thanks man !!!
|
|
|
|
|
I've been writing a client / server app for a while now, and in the original version I had a load of exception handling. Recently I've come to rewrite this and I think it's time for me to learn some lessons on what exactly I'm doing. The first part I need to solve is my client connection to a remote Unix server.
_connectionSocket.LocalSocket =<br />
<br />
new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );<br />
<br />
_connectionSocket.TimeStamp = DateTime.Now;<br />
<br />
IPEndPoint remoteEndPoint = new IPEndPoint( Dns.GetHostEntry( remoteIp ).AddressList[ 0 ], remotePort );<br />
<br />
_connectionSocket.LocalSocket.Connect( remoteEndPoint );<br />
<br />
_connectionSocket.LocalSocket.BeginReceive( _connectionSocket.DataBuffer, 0, SocketPacket.BufferSize,<br />
<br />
SocketFlags.None, OnDataReceived, _connectionSocket );
_connectionSocket is SocketPacket object containing my socket, the buffer etc. I'm following what I've seen done in other comms code. When I disconnect;
if( _connectionSocket.LocalSocket != null)<br />
<br />
{<br />
<br />
_connectionSocket.LocalSocket.Shutdown( SocketShutdown.Both );<br />
<br />
_connectionSocket.LocalSocket.Close( 5 );<br />
<br />
}
I'm having issues in that when I'm trying to shutdown, my code is hanging (I know that 5 means seconds to wait to complete sending messages and I don't think that's it). And then I can't establish a new connection, I have to wait a few minutes before the connection is dropped. Can anyone guide me here/
|
|
|
|
|
Hi
I am working on a desktop application using C# n .NET 2.0. I have a BindingNavigator, BindingSource and a DataSet on a screen. Their properties are set as follows.
BindingNavigator1.BindingSource = BindingSource1;
BindingSource1.DataSource = DataSet1;
BindingSource1.DataMember1 = DataSet1.Table1;
Now the AddNewItem event of BindingNavigator looks something like and here is what I want to do.
void BindingNavigator1_AddNewItem_Click( sender s, EventArgs e )
{
// if( MyCond )
// Cancel this event;
// else
// Go Ahead;
}
I think there should have been e.cancle(); to cancel this event but it is not there. So I cannot find out how to cancel this event. Can anybody help me out?
|
|
|
|
|
This might help you
void BindingNavigator1_AddNewItem_Click( sender s, EventArgs e )
{
if( MyCond ) {
// delete the coming item
BindingNavigator1.BindingSource.CancelEdit();
} else{
// go ahead..
}
}
//C0ax
If it' stuck, DO NOT pull harder!
|
|
|
|
|
Thank you so much. It was really helpful. Thankx once again
|
|
|
|
|
Well the situation has become a bit complex. In my DataSet I have two tables say table1 and table2. They have one to many relation (no rule is set like for update, delete or accepct/reject changes). When I drop a binding source for the parent table i.e table1, I get another binding source for child i.e table2BindingSource1 after rebuilding the project. That is really helpful because when I set
//this.BindingNavigator1.BindingSource = table1BindingSource;
The self created BindingSource collaborates with the navigator itself and I need not to do any extra coding.
Now the problem is when I do
//this.BindingNavigator1.BindingSource.CancelEdit();
to cancel any changes made to DataSet in case user clicks Delete button one the Navigator.
This only works for the parent table i.e table1 and not for the child table or say for self created BindingSource.
How can I apply this CancelEdit for both the tables in the DataSet ( for both BindingSources ).
Can anybody help me out?
|
|
|
|
|
I have a table in MS SQL Server database like this;
ID int PK
User_ID int
Discussion_ID int
Message text
Date datetime
I want to execute this query in my source code;
DateTime currentTime = System.DateTime.Now;
sql = "INSERT INTO TBL_POSTS(User_ID, Discussion_ID, Message, Date) VALUES('";
sql += User.Identity.Name + "','";
sql += discussionId + "','";
sql += message + "','";
sql += "#" + currentTime + "#')";
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
ERROR: Conversion failed when converting datetime from character string.
How can I add DateTime field to databse.
|
|
|
|
|
I am not sure where the # comes from, that's not correct syntax ?
Is message in some way parsed to stop people using your form from using an injection attack to erase your database ?
your best option is to use a parameterised query or stored proc, and just passng the date through as a date.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillionOneHundredAndFortySevenMillionFourHundredAndEightyThreeThousandSixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it )
|
|
|
|
|
Christian Graus wrote: I am not sure where the # comes from, that's not correct syntax ?
That's the syntax used with an MS Access database.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
dataminers wrote: sql += message + "','";
sql += "#" + currentTime + "#')";
SQL Injection Attack Heaven... There are hackers out there who are just wetting themselves in anticipation of that code to going live so they can compromise your system.
Tips on how to prevent SQL Injection Attack[^] - And it will solve your data conversion problem too!
|
|
|
|
|
An Access database uses # around a date literal, MS SQL uses apostrophes. No database (to my knowledge) uses both.
For an Access database, the correct syntax would be:
...<br />
sql += message + "',#";<br />
sql += currentTime + "#)";
For an MS SQL database, the correct syntax is:
...<br />
sql += message + "','";<br />
sql += currentTime + "')";
However, I fully agree with the other posters that you should use a parameterised query. It both solves problem with date formats and the problem with SQL injection vonurability that you get when putting the values in the query without encoding them properly.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
how do i get data from the database
-- modified at 5:28 Wednesday 24th October, 2007
alok2171
|
|
|
|
|
alok2171 wrote: how do i get data from the database into the drop down box.
Use ADO.NET[^].
Also consider reading rule 2 of the forum guidelines.
Paul Marfleet
|
|
|
|