|
usually when you draw by overriding paint you need to tell the application when painting is required. This is done view the Invalidate and InvalidateRegion method that is inherited from the base class control. I was just throwing it out there as a possible avenue to consider since many of the custom drawing methods I do require calls to InvalidateRegion to work correctly and efficiently.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
I tried the invalidate methode but it didn' change anything expect for the fact that the drawn rect didn't fill up the client size as I want it. I don't think that this is the problem, I already used the double buffer in other projects without any problems.
|
|
|
|
|
I tried the invalidate method in another way and now it works
Thanks much
|
|
|
|
|
Hi all...
We are facing a strange oledb behaviour: here is the code,
<br />
oConn.Open();<br />
System.Data.Odbc.OdbcCommand oCmd = oConn.CreateCommand();<br />
<br />
oCmd.CommandText = "SELECT * FROM [" + this.strMandateNrOld + "A-PERS]";<br />
DataTable dtPers = new DataTable();<br />
dtPers.Load(oCmd.ExecuteReader());<br />
It works fine and it fills my DataTable, but when I analyze the content, I can see that some columns are not filled... In a table of 72 columns, 3 columns which content is DateTime and Char are blank, but we know that in the file they are not...
We tried changing the connection string, switching from ODBC to OleDb... but we always have the same problem...
Does somebody have any idea or suggestion?
|
|
|
|
|
It really depends on what your data source is. I worked with an ODBC connection to a PICK (IBM Universe) data source and had a similar problem. It ended up that the mapping of the view for ODBC in PICK was incorrect and had to be re-mapped. So depending on your data source, you may want to look at that is the first source.
Finally for testing purposes, you may want to use a generic third party query tool to see what is coming back from the connection. If it doesn't work in that tool, then you know that it is a problem on the data source end.
I have used the following tool with much success for troubleshooting. Query Tool ADO
Hogan
|
|
|
|
|
If I can understand, what I need to do is find the right connectionstring, right?
I downloaded the query tool you suggested, but whatever I do, I always get the same problem.
Now I may misunderstood your suggestion... what do you mean with remapping the datasource?
|
|
|
|
|
Joz,
What I mean is the following.
* Down the QTADO tool.
* Test your query to your datasource with the QTADO tool.
* If the query in your code is "SELECT * FROM customers WHERE CustomerID = 9", the put that exact query in QTADO and run it.
* If QTADO is missing the same columns that your program is missing, then there is most likely a problem with the Data Source or ODBC Driver.
* If you are using an older database like IBM Universe, you may have to remap your data a differently.
Hope this helps.
Hogan
|
|
|
|
|
I'm having a similar problem with an Excel file.
I’ve been trying to read in an Excel file using either a DataSet or DataTable with OleDbDataAdapter. Here’s the code snippet:
//Identify the data source Excel file
sLine = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
sLine += sFilePathAndName;
sLine += ";Extended Properties=Excel 8.0";
OleDbConnection con = new OleDbConnection(sLine);
con.Open();
sLine = "SELECT * FROM [PublishCalendarSpreadOneOff$]";
OleDbDataAdapter DataAdapt = new OleDbDataAdapter(sLine, con);
//Construct a data table to hold the data
DataTable DataTbl = new DataTable();
//Fill the data table with the spreadsheet data
DataAdapt.Fill(DataTbl); // ERROR this doesn't fill the data column if there's no data in the first row.
if (con != null) con.Close();
This ought to fill DataTbl with the spreadsheet data and does so with one problem. If the first row of data (not the column headers but the data) is blank in some cells the DataTbl has the column but never gets any data for the column. In the following illustration:
New Applied Margin Rate Previous Applied Margin Rate Percentage Change Tier New Discount rate
16,800 16,800 0.00% 100%
16,800 16,800 0.00% 100%
59,850 59,850 0.00% 1 100%
52,070 52,070 0.00% 2 87%
52,070 52,070 0.00% 3 87%
59,850 59,850 0.00% 4 100%
59,850 59,850 0.00% 5 100%
Is an Excel file. The DataTbl never gets any data for the “Tier” column apparently because the first data cell is blank. If I put any character in this cell it reads the file fine. Strangely, if I delete a first data cell in other columns, New Scanning Range for example, the remaining data reads fine. It’s not a cell formatting issue – I tested that several ways. I’ve spent some time web searching and haven’t found any solutions. Any clues on how to fix this?
|
|
|
|
|
Dear programmers,
I have the following question.
What is faster, C# or C++ if I have pure numerical calculations.
Are there any experiences?
Lets say, I want to invert (or multiply) "double-valued"-matrices of size 300 x 300 a lot of times and if I assume that both algorithmic versions (C# and C++) are using exactly the same algorithm
Kind regards
|
|
|
|
|
Tomerland wrote: What is faster, C# or C++ if I have pure numerical calculations.
Are there any experiences?
In my experience writing test code and observing the difference is much faster than posting a message and waiting for someone to reply. And that doesn't even take into account the reliability of the reply.
But seriously, this type of information should not be hard to find[^].
|
|
|
|
|
C++ is faster since it does not rely heavily on the .NET framework which takes up more memory which would resultingly slow your program.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Of course C++ is much much much faster!
(But if you are using C++.NET -by using .NET FCL- C++.NET actually is as slow as C#.NET!)
|
|
|
|
|
MohammadAmiry wrote: (But if you are using C++.NET -by using .NET FCL- C++.NET actually is as slow as C#.NET!)
Really? Not according to this article[^] written by someone on the C++ team, but you probably know better than him.
Another common misconception is that the same kind of superior performance on the .NET Framework can be attained regardless of the language you use—that the generated Microsoft intermediate language (MSIL) from various compilers is inherently equal. Even in Visual Studio .NET 2003 this was not true, but in Visual Studio 2005, the C++ compiler team went to great lengths to make sure that all of the expertise gained from years of optimizing native code was applied to managed code optimization. C++ gives you the flexibility to do fine tuning such as high-performance marshaling that is not possible with other languages. Moreover, the Visual C++ compiler generates the best optimized MSIL of any of the .NET languages. The result is that the best optimized code in .NET comes from the Visual C++ compiler.
|
|
|
|
|
I am new to C#. I have written a class library in C# that has a form. I want this form to return some value when it terminates. This form is called from some other project.
Lets assume I have a text box [text1] and a button [button1] on the form. When the form loads, user will provide some text in text1 and on clicking button1 the form will terminate and text will be returned.
I want to pass a variable ref to its [form's] constructor, then assign the this reference to some static ref variable so that it could be changed in button1's click event.
In short, I want to modify a constructor's ref parameter in an event procedure.
Thanks in advance,
Vipin.
|
|
|
|
|
Wel..you don't necessarily need to pass a ref variable to the constructor of the form. You can create properties to that form, say:
public string TextValue
{
get{return textBox1.Text}
set{textBox1.Text = value;}
}
All you have to do after that is to show the form with Show() or ShowDialog() and after that you read the value of the TextValue property.
Hope it helps.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
Passing an argument by reference is not the same thing as passing a reference as an argument. Passing by reference only specifies how the argument is handled in the call to the method, you can't take this behaviour and store it in a variable.
If you want a variable that the methods in the form can change, put the variable in the form class, and make it accessible as a property.
---
"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
|
|
|
|
|
It really worked. Thanks a lot.
So I think passing an argument by reference simply creates an alias of passed variable and no memory allocation is done while when a reference is passed as an argument, a reference type of variable is created [so the memory is allocated for it] and it is initialized with the same value [address] as the passing reference variable has. Right?
Thanks again,
Vipin.
|
|
|
|
|
Hi all,
I have little problem, I have a 2 Web applications (C#) and I'm Adding Firts One into Second's Referancecs and I can see First's NameSpaces and Methods without any problem but I have problem accessing Methods, VS can not see them.
Classes and methods are public.
when I press F12 I can see list of methods.
Thanks alot.
|
|
|
|
|
Add a new project with (Class Library) and add all shared functions in that project.
|
|
|
|
|
Try using this in a page within the second project.
<%@ Reference Page="project1_page.aspx" %>
Hope it helps.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
Hello,
I recently saw the following lines of code in the Page_Load block of a Web application and I'm wandering what exactly it does:
Response.AddHeader("pragma","no-cache")
Response.AddHeader("cache-control","private")
Response.CacheControl = "no-cache";
Thanks in advance!
Obi.
//obinnaaj Eof
|
|
|
|
|
|
led mike wrote: They hide that information in the documentation[^]
Curse them and their evil ways.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hey all.
First of all, please keep in mind that i am far from a proffesionel programmer, so dont go to hardcore on me.
The actual Q:
I have made a C# windows form, that connect to a remote mssql database, receives data, and plots it into a gridview. U can also add new data to the sql database. I made it update everytime u focus it, or change values. This however causes the program to hang all the time. Is there anyway to make it update in the background, perhaps every 10 secs, and then just pick of the most reason local version, everytime u focus it? I use tableadapter and dataset to store and edit the data in. Perhaps u could make it update the dataset in the background?
Anyways, i hope u guys understood just a little bit of what my problem is.
1000 x thx in advance
//ev00l
|
|
|
|
|
When you edit the data it is stored locally in the dataset. You then fetch the changes from the dataset and send them to the database as a bulk update. Simply move the database update part to a background worker and you should get much smoother operation. Just watch out though, if you fetch the updates and start sending them to the database you must make sure that you handle new local updates while sending the current ones.
|
|
|
|