|
Hi,
If you Want To Add Footer in DataGridView, For that one method may be
loop through the available rows and add the values and displaye them like
double amount=0;
int i=0;
for(i=0; i< dgv.rows.count-1;i++)
{
amount+=Convert.ToDouble(dgv.rows[i].cells[0].ToString());
}
dgv.Rows.Add();
dgv.Rows[i+1].Cells[0].Value=amount.ToString();
Hope This Hepls
Regards
Pankaj Joshi
|
|
|
|
|
Hello,
I am using this library in one of my project : http://www.codeproject.com/cs/miscctrl/SyntaxHighlighting.asp[^]
This is how i used it in my editor i've been working on:
<br />
shtb = new SyntaxHighlightingTextBox();<br />
shtb.Name = "shtb";<br />
shtb.Location = new Point(0, 0);<br />
shtb.Dock = DockStyle.Fill;<br />
shtb.WordWrap = false;<br />
shtb.ScrollBars = RichTextBoxScrollBars.Both;<br />
shtb.FilterAutoComplete = false;<br />
shtb.AcceptsTab = true;<br />
shtb.DetectUrls = false;<br />
shtb.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));<br />
<br />
<br />
shtb.Seperators.Add(' ');<br />
shtb.Seperators.Add('\r');<br />
shtb.Seperators.Add('\n');<br />
shtb.Seperators.Add('\t');<br />
shtb.Seperators.Add(',');<br />
shtb.Seperators.Add('.');<br />
shtb.Seperators.Add('-');<br />
shtb.Seperators.Add('+');<br />
<br />
<br />
shtb.ContextMenuStrip = EditorContextMenu;<br />
Controls.Add(shtb);<br />
this.Controls.Add(this.MainMenu);<br />
<br />
<br />
try<br />
{<br />
TextReader syntax_blue = new StreamReader("synHighLib_DB/blue.txt");<br />
string line = syntax_blue.ReadLine();<br />
while (line != null)<br />
{<br />
shtb.HighlightDescriptors.Add(new HighlightDescriptor(line, Color.Blue, null, DescriptorType.Word, DescriptorRecognition.WholeWord, true));<br />
line = syntax_blue.ReadLine();<br />
}<br />
syntax_blue.Close();<br />
}<br />
catch (Exception e)<br />
{<br />
MessageBox.Show("Exception Error : " + e.Message, "eAthena Script Editor");<br />
}
This is the contents of my blue.txt db file
0<br />
1<br />
2<br />
3<br />
4<br />
5<br />
6<br />
7<br />
8<br />
9
As you can see, i want to turn all interger that the user types in the editor into blue color. When i tried this in the compiled app, this is how it looks like:
http://img254.imageshack.us/img254/9892/untitledog4.png[^]
How do you set it up so that as you type all the defined syntax in the blue.txt db file turns blue? e.g. 123456 (as i type, it shud be blue)
|
|
|
|
|
Same with having everything inside " and " brown, i did this:
shtb.HighlightDescriptors.Add(new HighlightDescriptor("\"", "\"", Color.Brown, null, DescriptorType.ToCloseToken, DescriptorRecognition.StartsWith, false));
I compiled the app and tried to type like this "hello" and only once the first double quote became brown and then as soon as i typed the h, it stopped being brown.
Where im i going wrong? how can i get this right?
Thanks in advance for any help you can offer
|
|
|
|
|
|
Some of you may remember this post[^] from 2 months ago where I tried to figure out why after such great interviews I was passed over for the position. You were all very supportive and enouraging. Your suggestions were very helpful.
Well, today I'd like to follow up on that story. Some of you suggested that I should ask the interviewer for feedback about the code sample I had submitted. Well I did, and we emailed back and forth a couple times until I got the feedback I was after.
The feedback was that the program was written as a structured program and lacking extensive error handling. He had expected the program to be written in OOP, with more comprehensive error handling, logging capability and that I should have used the project as an opportunity to "show off".
I gladly followed his suggestions, rewrote the project and resubmitted it to him. After reviewing version 2, he suggested that minus the unit testing (which we had agreed would be omitted) it was a "technical tour de force".
Soon after I was contacted by 2 project teams from the same company (one was led by my interviewer) and asked if I was still available and interested in a position with the company. I had only just accepted a position with another company as a software consultant and so I declined the offers with the agreement to keep in touch and revisit the possibility in the near future.
I've taken home a couple lessons from this I'd like to share:
- Always put your best foot forward. Do your best work, submit your best answers and don't be afraid to take your time doing it.
- Read between the lines. I was asked several OOP questions by each interviewer (I had 3 separate interviews with this company).
- Don't give up, and don't take no for an answer!! If you want the job and you know you're qualified, you can demonstrate some great qualities as long as you're not a pest about it.
- Even if you don't get the job you can come away with something. Ask your interviewer for feedback. If you ask right, they'll be happy to tell you where you fell short and how you could improve for the next interview (wither it's with them or someone else).
Add your own comments and tell me what you think. I hope to write an article about this whole experience and would be interested to hear your feedback on my whole experience.
For those who are interested here are the two versions of the project I submitted:
Version 1.0
Version 2.0
|
|
|
|
|
|
I would like to intercept outgoing port 80 connections, redirect the http request, and inject the response back into the stream as if it had never been redirected.
Each time a user desires a web page, he transmits a request to a web server, and the web server transmits a response back to the user. Let us assume that user A is only able to access the IP address of user B, but user B is able to access the IP addresses of everybody. If user A desires a web page from someone other than user B, he will be unable to. The solution is as follows.
When user A requests a web page, instead of sending the request directly to the web server, the request is sent to user B. User B then requests the same request from the web server, and receives the corresponding response. That response is then sent back to user A.
To user A, it appears as if the request and response were completed with out having to send packets to user B. This is because all of the tunneling work goes on in the background. User A does not need to configure his web browser to connect to a certain proxy. Instead, when user A requests a certain page from a web server, a program running on user A's computer intercepts that request, does the necessary tunneling to user B, and finally injects the response back into user A's tcp stack, as if user A had himself contacted the web server.
I do not want to use a normal proxy. This all needs to occur in the background. The problem is implementing the previous paragraph. How do I tap into the windows tcp stack like that? I know that Google Desktop does it to modify search results, so it is definitely possible.
How do I do this? Sample code anyone? Sample projects? Any articles that have been written on this? Any help is welcomed.
Jason Donenfeld
ZX2C4 Software
|
|
|
|
|
only two letters away from being an asset
|
|
|
|
|
Real answers would be appreciated.
Please note -- this is not for any malicious purpose. This is for a legit project. Look at Google's use of this idea, for example.
|
|
|
|
|
Please explain how and where google has used this idea. I don't remember allowing any components to be installed on my system from the google website.
only two letters away from being an asset
|
|
|
|
|
Things are slightly different but essentially the same in theory.
When you install google desktop and make a search on google.com, the following happens:
You contact google.com and ask for search results. Google sends you an http response. Before returning to your browser, google desktop running on your system MODIFIES the response to add possible local queries and a link on the top that says "Desktop" (next to images groups etc).
|
|
|
|
|
Oh Google Desktop. That is certainly different than Google, the website. Guess it pays to clarify your post.
Sorry, don't use it.
only two letters away from being an asset
|
|
|
|
|
Any ideas how I can accomplish the task at hand?
|
|
|
|
|
I've done this once before by writing an NDIS Driver. That was many years ago and it certainly isn't possible in C#
The basic idea of an NDIS Driver is that it sits and monitors raw packets as they go to and from your network card and allows you an opportunity to drop, modify or permit the packet through. It operates at a very low level and you MUST understand how individual packets are stitched together at the network level (lower level than TCP or IP) because that is all you will see. You will not see a nice stream of data for one connection, you will see everything regardless of how fragmented it is.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
Hi
I have exactly the same problem. Have you find any answer
|
|
|
|
|
Write an NDIS driver to intercept the data at the packet level. You cannot do that in C# tho'
|
|
|
|
|
Hello , i have some problems when i am in fullscreen. First text was good in quality but it had problems in characters' edges , so i looked for GDI+ info and found this :
g.TextRenderingHint= System.Drawing.Text.TextRenderingHint.AntiAlias ;
Antialising made it better in edges , but it looked worse this time , it looked fogged ( i am not sure that it is the correct word)
How can i fix it ?
The code is below :
public StringFormat GetStringFormat()
{
int numChars = m_String.Length;
CharacterRange[] characterRanges = new CharacterRange[numChars];
Region[] stringRegions = new Region[numChars];
for (int i = 0; i < numChars; i++)
characterRanges[i] = new CharacterRange(i, 1);
StringFormat stringFormat = new StringFormat();
stringFormat.FormatFlags = StringFormatFlags.NoClip;
stringFormat.SetMeasurableCharacterRanges(characterRanges);
return stringFormat;
}
public void DrawText(double SampleTime, IntPtr pBuffer, int BufferLen)
{
Rectangle rec = this.ClientRectangle;
g = Graphics.FromImage(bitmapOverlay);
g.Clear(Color.Transparent);
g.SmoothingMode = SmoothingMode.HighQuality ;
g.TextRenderingHint= System.Drawing.Text.TextRenderingHint.AntiAlias ;
d = g.MeasureString(m_String, fontOverlay);
if (boolshadow == true)
{
SolidBrush myBrush = new SolidBrush (Color.Black );
g.DrawString(m_String, fontOverlay, myBrush, stringXPos + strshadow, stringYPos + strshadow);// System.Drawing.StringFormat.GenericTypographic
}
g.DrawString(m_String, fontOverlay, brush, stringXPos, stringYPos, System.Drawing.StringFormat.GenericDefault);
if (logo != null)
{
int xpos = (int)logoXPos;
int ypos = (int)logoYPos;
Rectangle dstRect = new Rectangle(xpos, ypos, logo.Width, logo.Height);
Rectangle r = Screen.PrimaryScreen.WorkingArea;
//MessageBox.Show(r.Width.ToString());
//MessageBox.Show(r.Height.ToString());
g.DrawImage(logo, dstRect,0,0, logo.Width, logo.Height, GraphicsUnit.Pixel, attr);
}
bitmapOverlay.RotateFlip(RotateFlipType.RotateNoneFlipY);
Bitmap v = new Bitmap(lWidth, lHeight, videoStride, System.Drawing.Imaging.PixelFormat.Format32bppPArgb, pBuffer);
g = Graphics.FromImage(v);
g.DrawImage(bitmapOverlay, 0, 0, lWidth, lHeight);
g.Dispose();
v.Dispose();
}
|
|
|
|
|
hi all
Can any one tell me how to open a text file in a text box and print the file contant
merwa
|
|
|
|
|
|
Haven't had much luck searching for this in the forums or online. I've done some programming in VB.NET and want to make the jump to C#. A lot of the beginning C# books are a little too introductory. I'm wondering if anyone has a recommendation for a book that is more focused on learning the language, syntax, and features of the language rather than a ground up intro to the .Net framework, OOP, etc... Any insight/recommendations would be greatly appreciated.
|
|
|
|
|
Illustrated C# 2005 or any Apress books are good.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
Thank you, this looks like just the type of book I was looking for. Ended up picking up this as well as Windows Forms Programming in C#. Thank you all for the help.
|
|
|
|
|
If in doubt use {}, end everything with ; and never ever captilize the first letter, ever
Seriously though, if you're comfortable and familiar with the framework and concepts of OO it won't be that hard.
I have an idea to help though. The following is a pretty good code converter, try writing VB stuff and see how it looks in C#:
http://www.carlosag.net/Tools/CodeTranslator/Default.aspx[^]
Doesn't do generics though.
------------------------------------------------
I'm largely language agnostic -
After a while they all bug me
------------------------------------------------
|
|
|
|
|
MidwestLimey wrote: never ever captilize the first letter
you may need an Application, a Form, a Console, and many more Controls...
|
|
|
|
|
addendum:
Use capitals only when forced to by the bloody framework and never make clear in 5 lines that which can be in-lined in one
Welcome to the C# club.
------------------------------------------------
I'm largely language agnostic -
After a while they all bug me
------------------------------------------------
|
|
|
|
|