|
mates,
does anyone here experience error on excel on c#?
i have an application which will generate an excel file using c# code. the problem is i uninstall office 2000 and install office 2007.
when i run my application. it will prompt unable to find excel.
please help me.
thanks.
C# Coudou
C# Developer
******************************
The best things in life are free
******************************
|
|
|
|
|
You need to change the references to the office dlls.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
ahh.. yeah. i forgot that one. now, fixed already.
thanks mate.
C# Coudou
******************************
The best things in life are free
******************************
|
|
|
|
|
Easily done, thats why I knew the answer
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi,
I had to move a MSAccess Database to a new location.
In VS2005: Is it possible to change the path only without recreating all queries and tableconectors etc.?
Thanks!
Ariadne
|
|
|
|
|
It should be, your connection string defines the path to the MDB, all the queries etc are running on the connection.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Ariadne wrote: I had to move a MSAccess Database to a new locati
so, you have just move the MDB file, then you dont need to change in any query or table etc. just change the DBpath in connection string .
Thanks
|
|
|
|
|
Abhijit Jana wrote: just change the DBpath in connection string
is there a usual way in VS2005? I tried to change all occurrences of the old DBPath into the new one. But VS allways looks at the old path.
Ariadne
|
|
|
|
|
one has to compile the project! Then the DB-Path is changed...
And if you want to use the new DB-Path in your xsd DataSet (eg. Data Preview) you have to restart VS.
Thanks
Ariadne
modified on Thursday, June 26, 2008 5:57 AM
|
|
|
|
|
protected void bn_delete_Click(object sender, EventArgs e)
{
bool atLeastOneRowDeleted = false;
// Iterate through the Products.Rows property
foreach (GridViewRow row in GridView1.Rows)
{
// Access the CheckBox
CheckBox cb = (CheckBox)row.FindControl("CheckBox1");
if (cb != null && cb.Checked)
{
// Delete row! (Well, not really...)
atLeastOneRowDeleted = true;
// First, get the StaffID for the selected row
int StaffID = Convert.ToInt32(StaffID.DataKeys[row.RowIndex].Value);
//"Delete" the row
DeleteResults.Text += string.Format
("This would have deleted StaffID {0}<br />", GridView1);
}
}
|
|
|
|
|
twistz wrote: // First, get the StaffID for the selected row
int StaffID = Convert.ToInt32(StaffID.DataKeys[row.RowIndex].Value);
That wont even compile, the 2nd reference to StaffID should be GridView1 .
|
|
|
|
|
Not a lot of help in your code is there?
Presumably StaffID.DataKeys is an array of some sort. How did you define it?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
You forgot to ask a question.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Are there any possibilities to split string like this :
"hello world" "aaa bbb" "ccc" 10.5 20.1 30.4
it must be split like this :
hello world
aaa bbb
ccc
10.5
20.1
30.4
Thx...
|
|
|
|
|
Tokenized the string with delimiter as space ' '. There will be couple of API which does this.
String.Split Method
Thanks,
Ashish
|
|
|
|
|
namespace ConsoleApplication2<br />
{<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
string str = string.Empty;<br />
str="bbb ccc ddd 10.5 20.1 30.4";<br />
string[] sstring = str.Split(' ');<br />
foreach (string s in sstring)<br />
{<br />
Console.WriteLine(s);<br />
}<br />
}<br />
}<br />
}
|
|
|
|
|
Please see my question again. Note the quote "aaa bbb" "ccc dddd" 10.1 20.2
You cannot just split using space.
|
|
|
|
|
stancrm wrote: "aaa bbb" "ccc dddd" 10.1 20.2
let me know how did you creting a string in this way ???
|
|
|
|
|
string str = "\"aaa bbb\" \"ccc dddd\" 10.1 20.2";
|
|
|
|
|
1. split the string use space character
2. trim each returned string use " character
i hope this usefull
dhaim
program is hobby that make some money as side effect
|
|
|
|
|
by coding u can do this like that
string[] mainstring;
string[] s = string.Empty;
string[] t = string.Empty;
s = yourstring.spilt('"');
for(int i=1;i<s.length;i++)>
{
if(i%2 != 0)
{
mianstring[i-1] = s[i]
}
int i = mainstring.length;
t = mainstring[i].split(' ');
i = i-1'
foreach(string s in t)
{
mainstring[i+1] = s;
}
}
wasim khan
|
|
|
|
|
Not tested:
public List<string> SplitLine(string line)
{
List<string> items = new List<string>();
MatchCollection matchCollection = Regex.Matches(line, "\"[^\"]*\"|[^\"]*");
foreach (Match match in matchCollection)
{
string group = match.Value.Trim();
if (group != string.Empty)
{
if (group[0] == '"')
{
items.Add(group.Trim(new char[] {'"'}));
}
else
{
items.AddRange(group.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries));
}
}
}
return items;
}
Hope this helps.
modified on Thursday, June 26, 2008 7:48 AM
|
|
|
|
|
I just found the answer.
static string[] ParseStringUsingRegex(string input)
{
Regex regex = new Regex("\"([^\"]+?)\" ?|([^ ]+) ?| ");
MatchCollection matches = regex.Matches(input);
string[] result = new string[matches.Count];
for(int i = 0; i < matches.Count; i++)
{
Match match = matches[i];
result[i] = match.ToString().Replace("\"", "").Trim();
}
return result;
}
|
|
|
|
|
Hi,
I want to store Key-Value pairs in some data structure. In this "Keys" need not be unique , so HashTable cannot be used.
The size of the collection should dynamically increased.
I am not able to locate any data structure suitable to my requirement in C#.
Please let me know if you have anything your side.
Thanks,
Ashish
|
|
|
|
|
Hello Ashish,
Try using the GUID structure for the same. You may refer to the given
web link for more assistance with generating GUID keys.
http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=335
http://www.csharphelp.com/archives/archive188.html
I hope this will help.
Regards,
Allen
Allen Smith
ComponentOne LLC
www.componentone.com
|
|
|
|