|
too Smart!! but I am asking for ideas as well..
|
|
|
|
|
jrahma wrote: asking for ideas as well..
What kind of ideas are you thinking of?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
what's the best way to do it?
how can i use the autocomplete with the ValueMember?
How to avoid adding new values and stick to the DisplayMember values?
|
|
|
|
|
Hello all, I'm having some trouble with richTextBox. Using c# in Visual Studio 05.
What I do first is to copy the control code ({\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard)
in a string, and then the text I need from an rtf file (\f0This is some {\b bold} text.\par) in another string and combine them, I do this for loading specific lines of the file...
Anyway, the problem is that when I load this in a richTextBox (rtb.Rtf = myString;), I noticed that the control code is changed. For example if the control code cotains code for 5 fontsyles in its fontable
({\f0\fnil\fcharset161 Microsoft Sans Serif;}{\f1\fnil\fcharset0 Tahoma;}{\f2\fnil\fcharset0 Arial;}{\f3\fnil\fcharset0 Arial Black;}{\f4\fnil\fcharset0 Arial Narrow;}),
if the text uses only 3 of them the rest two are not included in the control code of the richTextBox
({\f0\fnil\fcharset0 Tahoma;}{\f1\fnil\fcharset0 Arial Black;}{\f2\fnil\fcharset0 Arial Narrow;}).
I hope you understand what my problem is.
Is there a way of avoiding this to happen, or, if not, how can I control this so when I need to make some changes in the fontstyle of the text, the file will be updated with no mistakes (like f1 is "Tahoma" and not "Arial Black")?
|
|
|
|
|
Hi All,
Im very new in this and im trying to use a datagridview to show some data from sql server.
The user can select multiple rows in the datagridview and ofter pressing the 'del key' and clicking on the 'Save'button, the selected rows will be removed.
The problem is that the last row always remains and can't be remove.
Here some code of how im trying to update the datatable :
myconn = new SqlConnection(ConnectionString);
SqlCommandBuilder cb_imp = new SqlCommandBuilder(myda);
myconn.Open();
myda.Update(mydt);
Can anyone tell me how to fix this?
Thanx.
|
|
|
|
|
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.
|
|
|
|