|
Sir;
Thank you very much. I can see from this example exactly how to acomplish what I wanted. Thanks also for the tips...and for reminding me that I need to clean up after myself i.e.
cnn.Dispose();
You have been most helpful!!
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
Glad to help
Regards
Intelligence is almost useless for those who have nothing else!
Email: caiokf@gmail.com
|
|
|
|
|
Rafone wrote: Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
I like that
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
I have created a custom datagridviewcell that is to take a double value
from the database and parse it into a string that displays a date in a
certain format. I have the conversion process working.
The trouble that I am having is getting and pushing the double value
to/from the database. Of course the FormattedValue that is generally
pushed to the database is the string but I want the double that generated
the string.
Any ideas on how I can change the property that is bound to the database
instead of FormattedValue?
Brian
|
|
|
|
|
I figured it out.
What I did was override the cell's Paint method and paint the string I
wanted displayed in the cell leaving the double value as the cells
formattedValue. I then overrode the cell's ParseFormattedValue method
to take the string that the user input, convert it to the appropriate
double representation and make it the formattedValue of the cell. This
displayed the correct value to the user while maintaining the correct
double value as the cells value for pushing back to the database.
I also had to create a new DataGrodViewEditControl to display the
correct string to the user when editing.
If anyone has a similar problem and wants a look at the code, email
me at liedtke@frii.com.
Brian
|
|
|
|
|
I'm trying to make a username grabber from a game's highscores page.
http://hiscore.runescape.com/hiscores.ws[^]
The name I want to grab will be in the center where it says "KingDuffy 1"
How would I go about doing this?
Thanks,
Buckley.
|
|
|
|
|
This is how you extract the source:
http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_20739698.html
i don't know the best way to grab the usernames, but i would probably put the whole source into a string, substring it by figuring out where the highscorelist starts and ends, and then maybe split the tablerows apart. But that's alot of code, and i think you should look into regular expressions, which might solve your problem in a better way.
|
|
|
|
|
Ok thanks, Im going to try that btw that link is to a site where they will help you if you pay and I don't like that. Does anyone have anymore insight on this?
Thanks,
Buckley.
|
|
|
|
|
scroll to the bottom of the page that i linked to
EDIT: weird, if you come from google you can see the answer.. paste the link onto google.com and visit it from there. then scroll to the bottom.
|
|
|
|
|
Ok I looked at I already know how to get the html source, but I need to retrieve only the username. This is the html source.
http://paste-it.net/public/dfe778b/[^]
On line 339 contains on of the usernames "Kingduffy 1" but it's not always on line 339 so thats why i need to know how to strip it and retrieve all the usernames on that page.
|
|
|
|
|
What I've done in the past to grab information from a web page is to take
the web page returned as a string from the StreamReader.ReadToEnd()
method of the StreamReader used to get the web page and break it into an
array of HTML tokens. It is pretty starightforward to scan the array
to find the data you want.
The tokenizer I created to do this is as follows:
/// <summary>
/// Tokenize the passed string which contains an HTML page into HTML elements
/// </summary>
/// <param name="InStr">The HTML page to parse.</param>
/// <returns>An array of strings that contains the seperate elements of the passed HTML page.</returns>
private string[] Tokenize(string InStr)
{
ArrayList buf = new ArrayList();
int begin = 0, end = 0;
bool in_tag = false;
while (end != -1) // IndexOf returns -1 when end of string encountered
{
if (!in_tag)
{
end = InStr.IndexOf("<", begin); // find index of start of next HTML tag
if (begin < end) // if there is length to the token.
buf.Add(HttpUtility.HtmlDecode(InStr.Substring(begin, end - begin))); // Add token to list
begin = end;
in_tag = true;
}
else
{
end = InStr.IndexOf(">", begin); // find index of end of HTML tag
buf.Add(InStr.Substring(begin, end - begin + 1)); // Add HTML tag to list.
begin = end + 1;
in_tag = false;
}
}
return ((string[])buf.ToArray(typeof(string)));
}
|
|
|
|
|
Whoops. The posting converted the '<' and '>' characters
to the HTML equivalent '>' and '<' repectively making
this hard to read.
Instead of cluttering this up with posting a new snippet
email me at liedtke@frii.com if you want the code.
Brian
|
|
|
|
|
Joshua,
Your email address is bouncing. It is the gmail.com account.
Re-email me with a valid address.
Brian
|
|
|
|
|
Hi
I have an item in my Solution folder (see here[^])
How can I access it ?
By the way I set Build Action of it to Resource .
Thanks in advance.
|
|
|
|
|
You could use like
Stream stream = YOUR_ASSEMBLY.GetManifestResourceStream("Smile.icons.majid.gif");
Or you could try to access it like visual studio in the form designers?
Add to the project resources and use it like:
public Image SomeImage
{
get { return global::Smiles.Properties.Resources.000; }
}
Intelligence is almost useless for those who have nothing else!
Phone: +55 51 81252.425
Email: caiokf@gmail.com
|
|
|
|
|
Thank you Caio Kinzel Filho.
Caio Kinzel Filho wrote: Stream stream = YOUR_ASSEMBLY.GetManifestResourceStream("Smile.icons.majid.gif");
How can I find MY_ASSEMBLY name ?
|
|
|
|
|
Often you will be looking in tha same assembly of your executing code, so:
Assembly.GetExecutingAssembly()
If not, look for methods in the Assembly class and I'm sure you will get it!
PS.: Don't forget to use the System.Reflection namespace
Intelligence is almost useless for those who have nothing else!
Email: caiokf@gmail.com
|
|
|
|
|
how can i send messages to gtalk or yahoo messenger and receive from it.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Do not attempt to bump your post to the top of the forums. That's bad form - very bad form.
|
|
|
|
|
I second that. It's bad enough some clown on the town/community forum for my area loves to do this to keep old, dead threads, alive. I think the chap is still trying to figure out what FFS means
"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
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I need to get sql command text where parameters are replaced by values.
I tried code below but displayed sql statement contains parameter names,
not actual values.
How to obtain command where parameters are replaced by their values ?
Andrus.
static IDataReader ExecuteReader(string command
, out IDbConnection connection
, CommandBehavior behavior
, params IDbDataParameter[] dataParams)
{
connection = ...
connection.Open();
IDbCommand cmd = new SqlCommand(command, connection as
SqlConnection);
foreach (IDbDataParameter p in dataParams)
cmd.Parameters.Add(p);
MessageBox.Show(cmd.CommandText);
return cmd.ExecuteReader(behavior |
CommandBehavior.CloseConnection);
}
Andrus
|
|
|
|
|
As far as I know you can't get the actual command text that is executed programmatically. With sql server you can use sql server profiler to see the command being executed.
|
|
|
|
|
There is a tricky way to do it.
ADO not seems to help providing the SQL query with the proper values prior running.
Here my code snippet that will do the job and may be easily converted any other .NET variant. It's a simple example but may be a start.
Some basic checks were done regarding quotes and backslashes but for sure this code need some care before use on production enviroment.
Note: You will need to change the type SQLiteCommand/SQLiteParameter to the one that matches your ADO methods set.
public static string getQueryFromCommand(SQLiteCommand cmd)
{
string CommandTxt = cmd.CommandText;
foreach (SQLiteParameter parms in cmd.Parameters)
{
string val = String.Empty;
if (parms.DbType.Equals(DbType.String) || parms.DbType.Equals(DbType.DateTime))
val = "'" + Convert.ToString(parms.Value).Replace(@"\", @"\\").Replace("'", @"\'") + "'";
if (parms.DbType.Equals(DbType.Int16) || parms.DbType.Equals(DbType.Int32) || parms.DbType.Equals(DbType.Int64) || parms.DbType.Equals(DbType.Decimal) || parms.DbType.Equals(DbType.Double))
val = Convert.ToString(parms.Value);
string paramname = "@" + parms.ParameterName;
CommandTxt = CommandTxt.Replace(paramname, val);
}
return (CommandTxt);
}
Bruno Ratnieks
CTO Sniffer.net
bruno@sniffer.net
|
|
|
|
|
Hello
I want to detect a mouse StandBy state
I presume that I can do that by combining the MouseMove event and a timer event
But I have no experience with timer event in Csharp
So, before to re-invent the wheel Im looking for some example / suggestion
Thanks for any help
|
|
|
|
|
With forms there's the Control.MouseHover Event.
To implement your own, something like this maybe...
How to detect NO mouse movement[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|