Click here to Skip to main content
       

C#

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
QuestionHow to show file association icon,one button and a progress bar on webbrowser control c#memberTridip Bhattacharjee1 Jan '13 - 6:50 
i work with webbrowser for showing simple text. i am in situation where i want that when user drag any file on webbrowser control then i want to show a icon for that file and one progressbar and one button programmatically. i manage to show file associated icon ob richtextbox just like using
System.Drawing.Icon.ExtractAssociatedIcon(string filePath)
 
here is the code for handling file drag drop on richtextbox like below one
 
    public Form1()
        {
            InitializeComponent();
            richTextBox1.AllowDrop = true;
            //richTextBox1.EnableAutoDragDrop = true;
            this.richTextBox1.DragEnter += new DragEventHandler(richTextBox1_DragEnter);
            this.richTextBox1.DragDrop += new DragEventHandler(richTextBox1_DragDrop);
        }
    
        void richTextBox1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
        {
            if ((e.Data.GetDataPresent(DataFormats.FileDrop)))
            {
                e.Effect = DragDropEffects.Copy;
            }
        }
        void richTextBox1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        {
            //Image img = default(Image);
            //img = Image.FromFile(((Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString());
            //Clipboard.SetImage(img);
    
            //this.richTextBox1.SelectionStart = 0;
            //richTextBox1.AppendText("Hello");
            //this.richTextBox1.Paste();
    
            /*
                Dim img As Image = Image.FromFile(fname)
                Clipboard.SetImage(img)
                RichTextBox1.Paste()
            */
    
            string strFilePath = ((Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
            Icon oIcon= System.Drawing.Icon.ExtractAssociatedIcon(strFilePath);
            Bitmap myBitmap = new Bitmap(oIcon.ToBitmap());
            Clipboard.SetDataObject(myBitmap);
            DataFormats.Format myFormat = DataFormats.GetFormat(DataFormats.Bitmap);
            richTextBox1.Text = "";
            if (richTextBox1.CanPaste(myFormat))
            {
                richTextBox1.Paste(myFormat);
                richTextBox1.AppendText("   " + System.IO.Path.GetFileName(strFilePath));
            }
            else
            {
                MessageBox.Show("The data format that you attempted site" +
                  " is not supportedby this control.");
            }
        }
 
here is one image link for your visualization purpose http://i.stack.imgur.com/5oRkt.png
i want to accomplish the same thing for webbrowser control for handing file drag drop and want to show one file associated icon and one progressbar and one button. please guide me with sample code for doing with webbrowser control. thanks
tbhattacharjee

Question"sendkeys" does not work KnightOnlinememberismail2031 Dec '12 - 3:09 
knightonline "SendKeys" or similar code does not work
AnswerRe: "sendkeys" does not work KnightOnlinemvpDave Kreskowiak31 Dec '12 - 3:28 
We have no idea what you're talking about.
 
But, if you're trying to use SendKey with a DirectX based game chances are really good it's not going to work.

GeneralRe: "sendkeys" does not work KnightOnlinememberismail2031 Dec '12 - 3:42 
So how do I run it? because there are those who
GeneralRe: "sendkeys" does not work KnightOnlinemvpDave Kreskowiak31 Dec '12 - 5:38 
You might want to provide some details as to what you're doing. I have no idea what "KnightsOnline" is and what you're trying to do.
 
You also might want to use complete sentences. "Because there are those who" doesn't make any sense to me.

GeneralRe: "sendkeys" does not work KnightOnlinememberismail2031 Dec '12 - 6:30 
for example, the game will come down in the right-click mouse. or 1 or 2 key are flat
GeneralRe: "sendkeys" does not work KnightOnlinemvpDave Kreskowiak31 Dec '12 - 6:47 
I don't know what you're talking about.
 
Assume I know NOTHING about KnightOnline, since I don't. I have no idea what you're doing and you're not providing any background information to tell me what I need to know.

GeneralRe: "sendkeys" does not work KnightOnlinememberismail2031 Dec '12 - 7:35 
Dave Kreskowiak, ty bro !
 
do you have someone who can help ?
GeneralRe: "sendkeys" does not work KnightOnlinememberMarcus Kramer31 Dec '12 - 7:53 
"SendKey" and an online game makes me think you are trying to write a bot or something of that nature. Is that correct?
If so, then perhaps the game servers have some sort of bot-detection system built in that is simply gobbling up your requests and ignoring them.
I wasn't, now I am, then I won't be anymore.

GeneralRe: "sendkeys" does not work KnightOnlinemvpDave Kreskowiak31 Dec '12 - 7:59 
I'm not your "bro".
 
And it's unlikely anyone can help because you haven't given all the background information required to figure out what you're doing.

GeneralRe: "sendkeys" does not work KnightOnlineprotectorPete O'Hanlon31 Dec '12 - 9:01 
If you can't explain your problem properly, we can't help. So far you haven't posted a single coherent thought. Tell us what you are trying to accomplish and don't assume that we can figure your problems out with random phrases.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos

CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

GeneralRe: "sendkeys" does not work KnightOnlinememberharold aptroot31 Dec '12 - 12:40 
Try SendMessage with types 0x100 (key down) and 0x101 (key up). The keycode goes in wParam.
AnswerRe: "sendkeys" does not work KnightOnlinemvpAbhinav S1 Jan '13 - 4:38 
Here is the documentation for SendKeys[^]. This could help you out (no idea what knightonline is).

AnswerRe: "sendkeys" does not work KnightOnlinemember ProgramFOX1 Jan '13 - 5:52 
Hi,
 
SendKeys.SendWait[^] can help you.
 
ismail20 wrote:
knightonline

What's knightonline? If you refer in your question to "knightonline", then you need to tell what it is.
In some cases, my signature will be longer then my message...
<em style="color:red"> <b>ProgramFOX</b></em>
ProgramFOX

AnswerIt's a game :)memberEddy Vluggen1 Jan '13 - 6:01 
..and just like with Warcraft, there are limits to what you can and are allowed to do. Their website has it's own forum, I suggest you post your question there. And don't be surprised if it's labeled "cheating" Smile | :)
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]
They hate us for our freedom![^]

GeneralRe: It's a game :)member ProgramFOX1 Jan '13 - 6:05 
Eddy Vluggen wrote:
don't be surprised if it's labeled "cheating"

Laugh | :laugh:
In some cases, my signature will be longer then my message...
<em style="color:red"> <b>ProgramFOX</b></em>
ProgramFOX

Generalto access latitudes and longitudes from databasemembernaveen 201230 Dec '12 - 22:28 
i have latitudes and longitudes i want to calculate distance between those latlongs and also how to retrieve existed latlongs from database like sql in c#
GeneralRe: to access latitudes and longitudes from databasemvpOriginalGriff30 Dec '12 - 23:22 
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Edit your question and provide better information.
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.

GeneralRe: to access latitudes and longitudes from databaseprotectorPete O'Hanlon30 Dec '12 - 23:54 
Well, if your database doesn't support geo types, you could always store them as floats. To get the difference, use the Haversine[^] formula.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos

CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

GeneralRe: to access latitudes and longitudes from databasememberEnnis Ray Lynch, Jr.31 Dec '12 - 5:36 
How about some codez:
 
/// <summary>
/// Will return the distance between two lat and long in km
/// </summary>
/// <param name="location"></param>
/// <returns></returns>
public double HaversineDistance(Location location) {
	double R = 6371; // Radius of the earth in km
	double dLat = (location.Latitude - Latitude).ToRadians();  // Javascript functions in radians
	double dLon = (location.Longitude - Longitude).ToRadians();
	double a = Math.Pow(Math.Sin(dLat / 2), 2) +
		Math.Cos(Latitude.ToRadians()) * Math.Cos(location.Latitude.ToRadians()) *
		Math.Pow(Math.Sin(dLon / 2), 2);
	double c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
	double d = R * c; // Distance in km
	return d;
}
Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting.
 
"And they, since they Were not the one dead, turned to their affairs" -- Robert Frost
 
"All users always want Excel" --Ennis Lynch

GeneralRe: to access latitudes and longitudes from databasememberPIEBALDconsult31 Dec '12 - 6:22 
naveen 2012 wrote:
calculate distance between those latlongs

 
"Great circle" distance? Or "rectilinear" distance? Or "digging a hole to China" distance?
 

P.S. I forgot about the "Dalek Dave Pub Crawl Distance". Blush | :O
Questionhow to extract tag in regular expressions c#memberngoanrazor30 Dec '12 - 5:02 
<div class="bo9 space">
           			<table border="0" cellspacing="0" cellpadding="0" class="bot">
          				<thead>
          					<tr>
              					<th class="bor f2" colspan="13"><h2>Mở thưởng chủ nhật ngày 30/12/2012</h2>
								</th>
            				</tr>
            			</thead>
            			<tbody>
    						<tr>
              					<td class="span-2 bol f1b db"><h3>Đặc Biệt</h3></td>
              					<td class="bor f2 db" colspan="12">21505</td>
            				</tr>
            				<tr>
              					<td class="span-2 bol f1b"><h3>Giải Nhất</h3></td>
              					<td class="bor f2" colspan="12">00305</td>
            				</tr>
            				<tr>
              					<td class="span-2 bol f1b"><h3>Giải Nhì</h3></td>
              					<td class="bol f2" colspan="6">16086</td>
              					<td class="bor f2" colspan="6">54638</td>
            				</tr>
           					<tr>
              					<td class="span-2 bol f1b" rowspan="2"><h3>Giải Ba</h3></td>
              					<td class="bol f2" colspan="4">85671</td>
              					<td class="bol f2" colspan="4">74937</td>
              					<td class="bor f2" colspan="4">60046</td></tr>
              					<tr><td class="bol f2" colspan="4">48910</td>
              					<td class="bol f2" colspan="4">28668</td>
              					<td class="bor f2" colspan="4">73173</td>
            				</tr>
            				<tr>
              					<td class="span-2 bol f1b"><h3>Giải Tư</h3></td>
              					<td class="bol f2" colspan="3">2979</td>
              					<td class="bol f2" colspan="3">1875</td>
              					<td class="bol f2" colspan="3">9307</td>
              					<td class="bor f2" colspan="3">1100</td>
            				</tr>
            				<tr>
              					<td class="span-2 bol f1b" rowspan="2"><h3>Giải Năm</h3></td>
              					<td class="bol f2" colspan="4">7891</td>
              					<td class="bol f2" colspan="4">4924</td>
              					<td class="bor f2" colspan="4">2383</td></tr>
              					<tr><td class="bol f2" colspan="4">6579</td>
              					<td class="bol f2" colspan="4">7116</td>
              					<td class="bor f2" colspan="4">1362</td>
            				</tr>
            				<tr>
              					<td class="span-2 bol f1b"><h3>Giải Sáu</h3></td>
              					<td class="bol f2" colspan="4">376</td>
              					<td class="bol f2" colspan="4">929</td>
              					<td class="bor f2" colspan="4">292</td>
            				</tr>
            				<tr>
              					<td class="span-2 bol f1b"><h3>Giải Bảy</h3></td>
              					<td class="bol f2" colspan="3">48</td>
              					<td class="bol f2" colspan="3">15</td>
              					<td class="bol f2" colspan="3">65</td>
              					<td class="bor f2" colspan="3">62</td>
            				</tr>
            				<tr>
              					<th class="bor f1" colspan="13">Nhận KQXS <span class="sred">Thủ Đô</span> : Soạn <span class="sred">KXTD</span> gửi <span class="sred">8185</span></th>
            				</tr>
          				</tbody>
        			</table>
        		</div>
How to extract tab table in this html code use regular expressions?
Thank!
AnswerRe: how to extract tag in regular expressions c#memberPIEBALDconsult30 Dec '12 - 5:39 
Don't.
 
http://www.codinghorror.com/blog/2009/11/parsing-html-the-cthulhu-way.html[^]
 
Use an XmlDocument.
GeneralRe: how to extract tag in regular expressions c#mvpOriginalGriff30 Dec '12 - 21:20 
Short.
Sweet.
Accurate.
Thumbs Up | :thumbsup:
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.

GeneralRe: how to extract tag in regular expressions c#memberZac Greve31 Dec '12 - 12:16 
PIEBALDconsult wrote:
Use an XmlDocument.

 
Or the HTML Agility Pack[^]!

Bob Dole
The internet is a great way to get on the net.

D'Oh! | :doh: 2.0.82.7292 SP6a

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 21 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid