|
Hello,
I have a data grid, and l want to added some records some text boxes into the grid. I have 3 text boxes and the user might want to add the contents 1, 2, 3, or 4 times.
Example:
Enter data in the text boxes, and enter the number of rows you want added. So if the user enters 3 and then click a button, than the data in the text boxes will be entered on 3 different rows. The data will be repeated on 3 rows.
Is there a way to do this using the datagrid?
Many thanks in advance,
Steve
|
|
|
|
|
Don't try to manipulate the grid itself, instead, add the rows to your bound dataset.
- DougW48
|
|
|
|
|
Hi!
I need a good method to remove multiple blanks from a string and replace them with a single blank. For example: "This is a string" -> "This is a string". The method I am using now works fine but is a bit resource demanding (about 80% of the thread).
public static string RemoveMb (string strIn) // Remove multiple blanks
{
string search = @"\s+";
string replace = @" ";
strIn = Regex.Replace(strIn, search, replace);
return strIn;
}
Anyone know of a better method?
Best regards,
Daniel
|
|
|
|
|
public string st(string st)
{
for(string st1="";st!=st1;st1=st,st=st1.Replace(" "," "));
return st;
}
Sorry ...
|
|
|
|
|
Hmm, I took a quick look at and even tested that code. Does it do anything good at all?
Doesn't it just replace all blanks (even the multiple ones) with a "new" blank?
Best regards,
Daniel
|
|
|
|
|
Come on, take a look at the proposal and use your brain.
It's not so hard to find out that the first string in Replace has to consist of two blanks and that they're rendered as one blank because lainoo didn't quote his code in <pre>.
mav
|
|
|
|
|
Well, I guess it wasn't that hard to find out so I'll accept the heat for that one.
But it still doesn't work since the "multiple blanks" in my strings can consist of more than just two blanks.
Best regards,
Daniel
|
|
|
|
|
Did you try the code after correcting it?
It's supposed to replace double spaces with single spaces until the string doesn't change anymore.
Each run should halve the double spaces in your input string until there are only single spaces.
mav
|
|
|
|
|
Ahh! Tested it again now more thoroughly. My deepest apologies to both lainoo and You mav, the code works it just don't apply to tabs (\t) which the regexp "\s" seem to do. I got confused when I saw the big gaps in my string but when looked at closely they are mixed blanks and tabs. The method works way faster than the regular expression I used, now I need to find a way to include tabs.
I guess I'll have to go with a double run to first remove all tabs?
Thanks a lot!
Best regards,
Daniel
|
|
|
|
|
Nice to see you were persistent enough to actually try
I think a simple call to
st = st.Replace("\t"," "); before the loop does the trick.
You don't have to care about double (or more) tabs, since the resulting double (or more) blanks are taken care of in the loop anyway.
mav
|
|
|
|
|
String[] parts = strIn.split(' ');
StringBuilder newString = new StringBuilder();
for(int n=0; n<parts.Length; n++){
if(parts[n].Length > 0){
newString.Append(parts[n]);
newString.Append(" ");
}
}
newString.Remove(newString.Length-1, 1);
return newString.ToString();
_________________________________
Vote '1' if you're too lazy for a discussion
|
|
|
|
|
Can't get that to work since it seems to split directly after the first blank found and leaving the remaining blanks in the string-array items
Best regards,
Daniel
|
|
|
|
|
|
Hi,
How can I directlly connect to mySQL server from C# without an ODBC drive? connecting through ODBC means I have to include mySQL Connecter/ODBC in my distribution media.. I want to only distibute my application..
|
|
|
|
|
|
hello,
i have been told to develop an application that has a country map displayed along with all its states. now whenever i move my mouse over a state, the stae gets highlighted and when i click on a particular state an event gets trigerred and some data is displayed on the map. what tool should i do to accomplish this.
see this example
http://www.lq.com/lq/map/index.jsp[^]
|
|
|
|
|
|
Well the link that you gave as an example used Macromedia Flash to do the animation and the mouseover type of information. You could use an html map function to create a map on an image,it might allow you to put a mouseover type of event in, but it has been a while since I have done that. You could make evach state into an image in the application and then just use the custom drawing routines on CP to draw them for each state.
Is this a web app or a Windows App?
Steve Maier, MCSD MCAD
|
|
|
|
|
its a windows application. I couldnt figure out what you meant to say above so could you please elaborate what you meant...
|
|
|
|
|
Well you could use a flash plugin (OCX) in your application and then let the flash coding do all of the highlighting and animation. You could also make a custom drawn image or button that has the correct shape as each state, but that is alot of manual work.
Steve Maier, MCSD MCAD
|
|
|
|
|
Hi all,
I have a problem for data transactions across two databases.
That is one object's data is comprised of two tables from
two different databases. I can perform rollback and commit within
one database. But for this case, how can I perform rollback and commit
across two databases for the object ?
Thanks
|
|
|
|
|
two databases in same server?
Sorry ...
|
|
|
|
|
Have you looked at Microsoft DTC (Distributed Transaction Co-ordinator)?
|
|
|
|
|
Giday Dudes!!!
I have written a c# dll Shared Addin for Excel. In this dll Addin I reference a COM dll for Axapta. This COM is excluded in the dependencies as it will already exist on client computer.
An initial problem I am having is that when the VBA goes to create my C# object it says "Cannot create object". (I can see the object properties and methods though) Is this because vba does not like constructors in C# or you cannot pass parameters in the constructor. Or should I just be using Regasm tool
Another problem is that when I build the project it references my Axapta COM object from the folder it exists in. It seems to expect and needs the dll to be in the same folder on the client machine which it is often not. How can I get around this (build with reference to the dll in my project folder?). VB 6.0 takes the dll on the local machine that is registered.
Slightly confused, help needed
Cheers
mit
notsnoj
|
|
|
|
|
Jsut can help you with the last one:
If you have referenced your COM component via the COM tab in 'Add References' it will all work well. Although there is an absolute path in the properties your app will always use the registered one.
|
|
|
|