|
Have you selected the property "AllowUserToAddRow" of the datagridview to false?
|
|
|
|
|
|
On msdn it says about listview that, "In virtual mode, only the items required are created".
My questions is that who decides how many items are supposed to be displayed, is that the size of the listview. If so, then let's say if is set listview1.VirtualListSize=1000; and the listview size is listview1.Size=new Size(10,10); does it mean it loads only 1 ,2 ,3 or may be 4 items and the rest aren't loaded in memory.
Seondly, the image loaded sucessfully but it is blurred. it's not cleard at all
void listView1_DrawItem(object sender, DrawListViewItemEventArgs e)
{
Bitmap b = new Bitmap(120,60);
PictureBox p = new PictureBox();
p.SizeMode = PictureBoxSizeMode.StretchImage;
p.Image = Resource1.WinterImage;
p.DrawToBitmap(b,new Rectangle(0,0,120,60));
e.Graphics.DrawImage(b, e.Bounds);
}
If i add picturebox on a form loaded event like this, it's very clear
private void Form3_Load(object sender, EventArgs e)
{
PictureBox p = new PictureBox();
p.SizeMode = PictureBoxSizeMode.StretchImage;
p.Image = Resource1.WinterImage;
p.Location = new Point(300, 300);
Controls.Add(p);
}
|
|
|
|
|
AFAIK the ListView controls how many items it will request using RetrieveVirtualItem event. VirtualListSize defines the amount of items that can be retrieved (size of the actual data collection). This way the scroll bar scrolls as exopected.
Image blurring may be a result of scaling a bitmap. Since it's not vector-based, the result isn't clean.
|
|
|
|
|
Using a picture box in that manner may cause problems: it doesn't belong to any form, it doesn't have any specific size...
Why don't you just draw the "WinterImage" directly to the Bitmap? There's no need for a picture box.
|
|
|
|
|
Hi,
I am running visual studio 2008 under xp x64
All of a sudden the VS stopped working and can not see the toolbox controls...
So I tried re-install/repair/Uninstall. None of these work now and I get this error in the error log:
Any thoughts please? thanks
***EndOfSession***[07/10/08,07:40:50] Microsoft Document Explorer 2008: [2] Error: Installation failed for component Microsoft Document Explorer 2008. MSI returned error code 1603
[07/10/08,07:42:35] Microsoft Visual Studio 2008 Professional Edition - ENU: [2] ACTION FAILURE:Action ended 07:42:34: CA_ExportTempHxDs.3643236F_FC70_11D3_A536_0090278A1BB8. Return value 3.See MSI log for details.
[07/10/08,07:42:35] Microsoft Visual Studio 2008 Professional Edition - ENU: [2] ACTION FAILURE:Action ended 07:42:35: INSTALL. Return value 3.See MSI log for details.
[07/10/08,07:42:42] setup.exe: [2] ISetupComponent::Pre/Post/Install() failed in ISetupManager::InternalInstallManager() with HRESULT -2147023293.
[07/10/08,07:43:27] Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime): [2] Error: Installation failed for component Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime). MSI returned error code 1603
[07/10/08,07:45:26] Microsoft SQL Publishing Wizard: [2] Error: Installation failed for component Microsoft SQL Publishing Wizard. MSI returned error code 1638
***EndOfSession***[07/10/08,07:40:50] Microsoft Document Explorer 2008: [2] Error: Installation failed for component Microsoft Document Explorer 2008. MSI returned error code 1603
[07/10/08,07:42:35] Microsoft Visual Studio 2008 Professional Edition - ENU: [2] ACTION FAILURE:Action ended 07:42:34: CA_ExportTempHxDs.3643236F_FC70_11D3_A536_0090278A1BB8. Return value 3.See MSI log for details.
[07/10/08,07:42:35] Microsoft Visual Studio 2008 Professional Edition - ENU: [2] ACTION FAILURE:Action ended 07:42:35: INSTALL. Return value 3.See MSI log for details.
[07/10/08,07:42:42] setup.exe: [2] ISetupComponent::Pre/Post/Install() failed in ISetupManager::InternalInstallManager() with HRESULT -2147023293.
[07/10/08,07:43:27] Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime): [2] Error: Installation failed for component Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime). MSI returned error code 1603
[07/10/08,07:45:26] Microsoft SQL Publishing Wizard: [2] Error: Installation failed for component Microsoft SQL Publishing Wizard. MSI returned error code 1638
[07/10/08,07:45:44] VS70pgui: [2] DepCheck indicates Microsoft Document Explorer 2008 is not installed.
[07/10/08,07:45:45] VS70pgui: [2] DepCheck indicates Microsoft Visual Studio 2008 Professional Edition - ENU is not installed.
[07/10/08,07:45:45] VS70pgui: [2] DepCheck indicates Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime) is not installed.
[07/10/08,07:45:45] VS70pgui: [2] DepCheck indicates Microsoft SQL Publishing Wizard is not installed.
[07/10/08,07:49:18] Microsoft Visual Studio 2008 Professional Edition - ENU: [2] ACTION FAILURE:Action ended 07:49:18: CA_ExportTempHxDs.3643236F_FC70_11D3_A536_0090278A1BB8. Return value 3.See MSI log for details.
[07/10/08,07:49:18] Microsoft Visual Studio 2008 Professional Edition - ENU: [2] ACTION FAILURE:Action ended 07:49:18: INSTALL. Return value 3.See MSI log for details.
[07/10/08,07:49:20] setup.exe: [2] ISetupComponent::Pre/Post/Install() failed in ISetupManager::InternalInstallManager() with HRESULT -2147023293.
[07/10/08,07:49:26] VS70pgui: [2] DepCheck indicates Microsoft Visual Studio 2008 Professional Edition - ENU is not installed.
[07/10/08,07:57:20] Microsoft Document Explorer 2008: [2] Error: Installation failed for component Microsoft Document Explorer 2008. MSI returned error code 1603
[07/10/08,07:57:50] Microsoft Visual Studio 2008 Professional Edition - ENU: [2] ACTION FAILURE:Action ended 07:57:50: CA_ExportTempHxDs.3643236F_FC70_11D3_A536_0090278A1BB8. Return value 3.See MSI log for details.
[07/10/08,07:57:51] Microsoft Visual Studio 2008 Professional Edition - ENU: [2] ACTION FAILURE:Action ended 07:57:51: INSTALL. Return value 3.See MSI log for details.
[07/10/08,07:57:58] setup.exe: [2] ISetupComponent::Pre/Post/Install() failed in ISetupManager::InternalInstallManager() with HRESULT -2147023293.
[07/10/08,07:58:18] Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime): [2] Error: Installation failed for component Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime). MSI returned error code 1603
[07/10/08,07:59:24] Microsoft SQL Publishing Wizard: [2] Error: Installation failed for component Microsoft SQL Publishing Wizard. MSI returned error code 1638
***EndOfSession***
|
|
|
|
|
is there any C# question here???
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
You should have right-clicked in the toolbox pane, and selected "Reset Toolbox".
I don't know how to fix your problem if uninstall doesn't work.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I'm trying to export data from my Sql server database to an excel spreadsheet using bulkCopy.The problem is that whenever i run my application throws "Format of the initialization string does not conform to specification starting at index 0" error.Whatam i doing wrong? Here is my code
public class CopyData
{
string _sourceConnectionString = "Data Source= sict-sql;Initial Catalog=PSAtechZ;Integrated Security=True;";
string _destinationConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "E:\\+PSATECHZ EYES ONLY+\\PSAtechZTimetableSystem\\Students.xls" + "; Extended Properties='Excel 12.0; IMEX=1; HDR=YES'";
public CopyData(string sourceConnectionString, string destinationConnectionString)
{
_sourceConnectionString = sourceConnectionString;
_destinationConnectionString = destinationConnectionString;
}
public void CopyTable(string StudentModule)
{
using (SqlConnection source = new SqlConnection(_sourceConnectionString))
{
string sql = string.Format("SELECT * FROM [{0}]", StudentModule);
SqlCommand command = new SqlCommand(sql, source);
source.Open();
SqlDataReader dr = command.ExecuteReader();
//IDataReader dr = command.ExecuteReader();
using (SqlBulkCopy copy = new SqlBulkCopy(_destinationConnectionString))
{
copy.DestinationTableName = StudentModule;
copy.WriteToServer(dr);
}
}
}
}
i call this class under button export
|
|
|
|
|
That could only happen with the string.Format, but I cannot see anything wrong with it.
|
|
|
|
|
Never mind the first post from me. Misread the line.
Could it be this one:
Twyce wrote: string _destinationConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "E:\\+PSATECHZ EYES ONLY+\\PSAtechZTimetableSystem\\Students.xls" + "; Extended Properties='Excel 12.0; IMEX=1; HDR=YES'";
Since you have @ before the string, you don't need to escape backslash (even though it's on a separate string).
Using debugger:
@"part1" + "\\part2" + "\\part3"
gives
"part1\\part2\\part3"
|
|
|
|
|
thanx for ur reply but i get the error when it gets to this line
using (SqlConnection source = new SqlConnection(_sourceConnectionString))
|
|
|
|
|
i think the problem is with my source connectionString
|
|
|
|
|
The problem would appear to be at the line
string sql = string.Format("SELECT * FROM [{0}]", StudentModule); Step over this line in the debugger and see what StudentModule contains.
|
|
|
|
|
thanx for ur reply.Thing is it throwsan error when the debugger gets to this line
using (SqlConnection source = new SqlConnection(_sourceConnectionString))
|
|
|
|
|
When you step over this line, what's in _sourceConnectionString? I ask this because you've initialised it to a value, and then you change it in the constructor.
|
|
|
|
|
What do you mean when you say I change it in the constructor?
The debugger does not even allo me to step over the line,it just keeps throwing the error
|
|
|
|
|
The following is your code:
public class CopyData
{
string _sourceConnectionString = "Data Source= sict-sql;Initial Catalog=PSAtechZ;Integrated Security=True;";
string _destinationConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "E:\\+PSATECHZ EYES ONLY+\\PSAtechZTimetableSystem\\Students.xls" + "; Extended Properties='Excel 12.0; IMEX=1; HDR=YES'";
public CopyData(string sourceConnectionString, string destinationConnectionString)
{
_sourceConnectionString = sourceConnectionString;
_destinationConnectionString = destinationConnectionString;
}
public void CopyTable(string StudentModule)
{
using (SqlConnection source = new SqlConnection(_sourceConnectionString))
{
string sql = string.Format("SELECT * FROM [{0}]", StudentModule);
SqlCommand command = new SqlCommand(sql, source);
source.Open();
SqlDataReader dr = command.ExecuteReader();
using (SqlBulkCopy copy = new SqlBulkCopy(_destinationConnectionString))
{
copy.DestinationTableName = StudentModule;
copy.WriteToServer(dr);
}
}
}
} I've highlighted the line that changes the value. The code that creates this class is presumably doing something along the lines of CopyData c = new CopyData("connectionString", "destConnectionString");. Step into the CopyTable method and see what the value of _sourceConnectionString is before you execute the line
using (SqlConnection source = new SqlConnection(_sourceConnectionString))
|
|
|
|
|
it is not giving me a particular value just
_sourceConnection.sourceConnection
|
|
|
|
|
I think you're missing Pete's point. In the constructor you modify the value of the predefined _sourceConnectionString . Try adding the following message box:
...
public void CopyTable(string StudentModule){
System.Windows.Forms.MessageBox.Show("Going to connect to: " + _sourceConnectionString);
using (SqlConnection source = new SqlConnection(_sourceConnectionString))
{
... What is shown as the connection string that is used for connection? Is it what you would want ("Data Source= sict-sql;Initial Catalog=PSAtechZ;Integrated Security=True;" ) or something else.
|
|
|
|
|
I want to use the Task Scheduler 2.0 lib for XP Home Edition when users have not setup an account. It seems the SetAccountInformation method, requires both a username and password. I believe there is a work around by changing registry values, although if I could I would love to avoid implementing that. Any thoughts?
I'm coding in C#
Bunis The Code Gladiator
|
|
|
|
|
If I have one form running, and I make another form, and call ShowDialog of the second form, the first form is locked. How could I open a second form so that the user can still use and manipulate the first form?
Thanks.
modified on Thursday, September 4, 2008 6:01 PM
|
|
|
|
|
use .Show() instead of ShowDialog()..
May be this solves your problem
Santhapur
|
|
|
|
|
|
Hi,
use child/parent forms method (child forms that load in a parent form).
That will solve your problems, need to type from the start
Check here in codeproject for articles
(i don´t recall link, sorry)
Good Luck
nelsonpaixao@yahoo.com.br
|
|
|
|