|
Oh! I always thought you had to define delegation functions as new DelegateFunction(FunctionToCall);
Thanks a lot, you're a life-saver. This should make the system work much, much better
|
|
|
|
|
Glad to be of service.
|
|
|
|
|
I have a list box in my app and i want it to autoscrol downward so it would always show the last item added.
Thank you
|
|
|
|
|
I think you have to do it manually. After adding an item to the end, call EnsureVisible[^].
|
|
|
|
|
didn't quite catch that... can u be more specific with the code?
|
|
|
|
|
Something like this:
int index = listBox.Items.Add("New item");
listBox.EnsureVisible(index);
[EDIT: Wait!! I was thinking of ListView instead of ListBox. Sorry! I'm looking into it right now.]
|
|
|
|
|
Found it!! Use the TopIndex[^] property of the ListBox control.
[EDIT: Oops, Luc beat me to it. ]
|
|
|
|
|
Hi,
whenever you change the number of items, do a myLB.TopIndex=myLB.Items.Count-1;
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:31 AM
|
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
After hours of searching I finally got this far and I'm not getting any errors
from this code. However I'm getting a black image. Is there something amiss here. I need to get access to this image regardless of wether it's visible on the physical montior or not and I'm assuming this may be the best way.
IHTMLElement test = (IHTMLElement)webBrowser1.Document.Images[i].DomElement;
IHTMLElementRender testRender = (IHTMLElementRender)test;
int hScreen = GDI.CreateCompatibleDC(this.CreateGraphics().GetHdc());
testRender.DrawToDC((IntPtr)hScreen);
int hCompDC = GDI.CreateCompatibleDC((IntPtr)hScreen);
int nWidth = webBrowser1.Document.Images[i].ClientRectangle.Width;
int nHeight = webBrowser1.Document.Images[i].ClientRectangle.Height;
int hBmp = GDI.CreateCompatibleBitmap((IntPtr)hScreen, nWidth, nHeight);
int hOld = GDI.SelectObject((IntPtr)hCompDC, (IntPtr)hBmp);
GDI.BitBlt((IntPtr)hCompDC, 0, 0, nWidth, nHeight, (IntPtr)hScreen, 0, 0, GDI.SRCCOPY);
GDI.SelectObject((IntPtr)hCompDC, (IntPtr)hOld);
GDI.DeleteDC((IntPtr)hScreen);
GDI.DeleteDC((IntPtr)hCompDC);
Image img;
pictureBox2.Image = Bitmap.FromHbitmap((IntPtr)hBmp);
|
|
|
|
|
Hi again,
I'm trying to add a little fuction to my app. I have a form for navigating through rows in a database table. All fields (textboxes) are readonly except one, which is a field I want the user to use to go directly to a certain row in the db. All this happens when to user presses the tab button and calls the Validated method of the textbox. How would I go about that exactly? textbox name is txtClientCode , the data in the table is loaded in m_dtClientInfo data table, and data adapter is m_daClientInfo. Database is a MS Access OleDB.
Anyone have a link to a good tutorial on querying and stuff in c#? I checked the articles overhere but didn't find anything! Thanks a lot for your patience with a newb
Yup, I'm a NEWB
|
|
|
|
|
So, when your user tabs out of that specific control, you want to fill the other text boxes with the data at that specific row index? Something like this could do it:
private void txtClientCode_Validated(object sender, EventArgs e)
{
int rowIndex = -1;
if(!int.TryParse(txtClientCode.Text, out rowIndex))
return;
DisplayClientInfo(rowIndex);
}
private void DisplayClientInfo(int rowIndex)
{
DataRow row = m_dtClientInfo.Rows[rowIndex];
txtFirstName.Text = (string)row["FirstName"];
} I hope this helps
|
|
|
|
|
I finally tried it out like this and it works:
private void txtClientCode_Validated(object sender, EventArgs e)
{
try
{
OleDbDataAdapter l_daCCSearch = new OleDbDataAdapter(
"SELECT * from ClientFile WHERE ClientCode = '" + txtClientCode.Text + "'", m_connection);
DataTable l_dtCCSearch = new DataTable();
l_daCCSearch.Fill(l_dtCCSearch);
txtClientCode.Text = l_dtCCSearch.Rows[0]["ClientCode"].ToString();
txtAdress.Text = l_dtCCSearch.Rows[0]["Adress"].ToString();
txtCity.Text = l_dtCCSearch.Rows[0]["City"].ToString();
txtCompanyName.Text = l_dtCCSearch.Rows[0]["CompanyName"].ToString();
txtContactName.Text = l_dtCCSearch.Rows[0]["ContactName"].ToString();
txtCountry.Text = l_dtCCSearch.Rows[0]["Country"].ToString();
txtEmail.Text = l_dtCCSearch.Rows[0]["Email"].ToString();
txtFax.Text = l_dtCCSearch.Rows[0]["FaxNumber"].ToString();
txtPhone.Text = l_dtCCSearch.Rows[0]["PhoneNumber"].ToString();
txtPostalCode.Text = l_dtCCSearch.Rows[0]["PostalCode"].ToString();
txtProvince.Text = l_dtCCSearch.Rows[0]["Province"].ToString();
txtTaxCode.Text = l_dtCCSearch.Rows[0]["TaxCode"].ToString();
rtxtNotes.Text = l_dtCCSearch.Rows[0]["Notes"].ToString();
}
catch (IndexOutOfRangeException)
{
DialogResult result;
result = MessageBox.Show("Aucune entrée correspondante à votre requête n'a été trouvée.", "Erreur");
if (result == DialogResult.OK)
{
this.ShowCurrentRecord();
}
}
}
Thanks a lot you pointed me in the right direction
Yup, I'm a NEWB
|
|
|
|
|
Hi
How can i make pdf from text file or put my text in pdf file ?
(in C#)
thank's for any help
|
|
|
|
|
There probably should be some componentes that allow you to do this easily, but since I don't know about any of them, I'll give you two ideas:
1. Install something like PDFCreator or CutePDF, and then from C# print to one of the PDF pseudo-printers as if you were printing to a regular printer. This will generate a prompt for the filename at runtime (and require an installation on the client), but depending on your particular circumstances it might or might not be acceptable.
2. Use fyiReporting[^], which I just learned about it. It's a reporting control that can output to a variety of formats, including PDF.
Both ideas are free.
You could also try Google[^] and find a lot of results
|
|
|
|
|
HI,
I need to control office excel document in run time.
The problem is that i don't know the office version that install on the target machine ( can be office 2007 or office 2003 ) and I don't know if and how to set the iterope to the office object in run time.
Thanks for the help.
|
|
|
|
|
I'm developing a new application C#, before some days i came to know about the reflector tool, so, i download this from http://www.aisto.com/roeder/dotnet/ afterwards i use it, it'll show all the exact class, method and code. But i want to know how to write the secure code against reflector tool. I mean i don't want to show my code in reflector tool, then how to protect my code against reflector too
|
|
|
|
|
That's the way .NET is. Since it is only bytecode and not native, it can be decompiled by Reflector.
Try googling for a code obfusctor[^] to find alternatives that will rename your methods and variables, so at least it is much more difficult to understand. This option might be expensive, tough.
|
|
|
|
|
You probably are looking for an obfuscator. See, for instance, this page [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Code is never secure. But for the best results, try Mono's full static compilation or the Remotesoft obfuscator. I don't know of any obfuscator that actually works, but they may exist.
|
|
|
|
|
Write it in C++
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
.NET Reactor[^] is best way to protect your applications
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
hi,
Can some one please help me with articles that would assist me in developing a website for virtual stock market.
|
|
|
|
|
Maybe something like this? I know it isn't a web application but it should give you the general principles of stock market techniques which are used in the real world
using System;
using System.Collections.Generic;
namespace Stock
{
public struct StockShare
{
string Name;
long Value;
}
public class StockMarket
{
public static void Main(string[] args)
{
List<stockshare> stocks = new List<stockshare>();
Random rnd = new Random();
while (true)
{
foreach(StockShare stock in stocks)
{
int crashBy = rnd.Next(100, 5000);
if(stock.Value >= crashBy)
{
Console.WriteLine("Old value of " + stock.Name + ": " + stock.Value.ToString());
stock.Value -= rnd.Next(100, 5000);
Console.WriteLine("New value of " + stock.Name + ": " + stock.Value.ToString());
}
else
{
BailOut(stock);
Console.WriteLine(stock.Name + " has been bailed out. Expect further corruption");
}
}
}
}
public static void Bailout(StockShare stock)
{
stock.Value += 1000000;
}
}
}</stockshare></stockshare>
|
|
|
|