|
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
|
|
|
|
|
Hi Allen,
Thanks for your response .I am not looking for GUID .
The Key-value pair will be
For Eg ,
Lookup 49
0 "Unclassified"
1 "Background"
2 "Desktop"
1 "LZHL"
In which Key can be duplicate. I need DataStructure/Collection which can increase dynamically and can hold this values.
Thanks,
Ashish
|
|
|
|
|
Dictionary<object,List<object>>
|
|
|
|
|
It seems you need to have unique key in Dictionary also,
Dictionary<string,> keyValue = new Dictionary<string,>();
keyValue.Add("1","\"Background\"");
keyValue.Add("2", "\"AlignerFail\"");
keyValue.Add("3", "\"LZHL\"");
keyValue.Add("3", "\"Align\"");
Unhandled Exception as already a key present.
I need collection which should not contain uniqueness of key.
It should accept if keys are duplicate.
Can any way we can surpass the key field uniqueness in Hashtable/Dictionary collection??
Thanks,
Ashish
|
|
|
|
|
hi all
Iam Use ComboBox in Windows Application And I wount to use The ValueMember propertes And DisplayMember propertes . Iam Use it but the Value of this Oroper It is the end value of item Added to it .
Now wount to know how i can if the combo have 4 items and iam Select the item number 2 how i can Return the ValueMember from The ComboBox ??
thanks for any boudy Hellp me
Thaer
|
|
|
|
|
I don't really get the question. The DisplayMember sets what is used to display the object. When the selection changes, you can use the SelectedValue property to get the selected value.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
if you want to get the value then
string s;
s = comboBox.SelectedValue;
and if you want to get the selected item text then
string s;
s = comboBox1.SelectedText
wasim khan
|
|
|
|
|
wasimsharp wrote: string s;s = comboBox.SelectedValue;
Won't work. SelectedValue is an object, which would need casting, if it's even a string to start with.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|