|
Oh my! I read and read and read trying to find something like this. It is EXACTLY what I am looking for. I spent two days writing ArrayLists and all sorts of other stuff to try to keep track of the ID info!
Thanks a bunch for the response!!!!
|
|
|
|
|
for the following example str2 should be "dccc" but it is "dabcabcabc".
What's the problem?
class Program
{
static void Main(string[] args)
{
String str1 = "dabcabcabc";
String delim = "ab";
String str2 = str1.Trim(delim.ToCharArray());
Console.WriteLine("Delimiters: {0}", delim);
Console.WriteLine("Original string: {0}", str1);
Console.WriteLine("Trimmed string: {0}", str2);
Console.ReadKey();
}
}
modified 30-Nov-21 21:01pm.
|
|
|
|
|
You want Remove, not Trim. Trim removes from the edges, hence 'trim'.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
My bad
MSDN : String.Trim (Char[]) Removes all occurrences of a set of characters specified in an array from the beginning and end of this instance.
modified 30-Nov-21 21:01pm.
|
|
|
|
|
Hello
Try this instead:
class Program
{
static void Main(string[] args)
{
String str1 = "dabcabcabc";
String delim = "ab";
String str2 = str1.Replace(delim, "");
Console.WriteLine("Delimiters: {0}", delim);
Console.WriteLine("Original string: {0}", str1);
Console.WriteLine("Trimmed string: {0}", str2);
Console.ReadKey();
}
}
Regards
|
|
|
|
|
thanks ... that's what I wanted in the first place.
modified 30-Nov-21 21:01pm.
|
|
|
|
|
try using the split instead of the trim
|
|
|
|
|
was using C# to parse
if any one has prior experience.
|
|
|
|
|
|
What exactly is the question? I can't make anything useful of the two posts you created in this thread.
WM.
What about weapons of mass-construction?
|
|
|
|
|
Hi,
I know its last thing on a Friday but I hope someone can help.
I need to loop through every cell in a datagridview and make sure that each value is not null.
Looping through the cells isn't a problem (I don't think), I used a for loop with another nested inside, the inner loop taking care of the column index and the outer loop holding the row index.
What I can't do is check the contents of each cell as there is no suitable method in DataGridCell.
Please can anyone help?
Thanks
Scott
The loop code used if anyone is interested.
for (int i = 0; i <= rowCount; i++)
{
for (int j = 0; j <= colCount; j++)
{
DataGridCell dgc = new DataGridCell(i, j);
}
}
Scott
|
|
|
|
|
Are you looking for something like this...
grvMain.Rows[0].Cells[1].Text;
I hope this helps. I have worked quited a bit with gridviews so let me know if I misunderstood your question. If you have controls you are attempting to check in the cells it should look more like this...
((TextBox)GridView1.Rows[1].FindControl("txtProviderID")).Text.
Regards
|
|
|
|
|
I am trying to get data from the DataView in my form and put in a variable, preferably a string, that I can put manipulate and put into a document. My problem comes when I try to get the data from the DataView. Also, is there any way to configure settings so that users can only select the whole row, not individual cells?
-Fred
|
|
|
|
|
As far I can remember, in order to get a cell value you can use following snippet but please verify spellings with intellisense as I just typed from my memory.
string a = instanceDtataGridView.Columns["columnName"].SelectedRows[0].ToString();
To Select whole row, you can set the "Selection Mode" property of Datagrdiview, choose "Full Row Select". Again, I just typed the property name from my memory, you can find out easily about this property in the property editor of gridview.
Emran
|
|
|
|
|
I asked this a few days ago, but still haven't received a good answer.
How do I open an external application in a form? For example, I have a form called Form1. I want to run Foo.exe INSIDE OF Form 1. An answer to my previous quote understood it to be the equivalent of an IFrame in html. This sounds about right. But there's gotta be a way to do it in C#!!!
I know now that you can view .pdf's in a form, so it must be true you can open any application in a form...
Please help!
John
|
|
|
|
|
JohnBond311 wrote: I know now that you can view .pdf's in a form, so it must be true you can open any application in a form...
Not true at all. Some applications don't even have a user interface, to start with. Most applications have their own form, and you can't open a form in a form.
The application has to be created specially for being used as a component in a form.
---
b { font-weight: normal; }
|
|
|
|
|
JohnBond311 wrote: but still haven't received a good answer.
Perhaps, but you've probably received a 'right answer'. We don't change the laws of software here, we just report on them.
JohnBond311 wrote: so it must be true you can open any application in a form...
That's an astounding leap of faith. I know it's possible to buy real estate, therefore I should be able to buy the Grand Canyon. That's what you just said.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
JohnBond311 wrote: I know now that you can view .pdf's in a form, so it must be true you can open any application in a form...
No, the reason you can view a pdf in annother app is because Adobe wrote a pdf reader COM component and that component was then embedded into the application. The PDF viewing is not due to the stand alone acrobat reader being embedded.
|
|
|
|
|
Everyone else might shoot me for this...
But, it's "kind of" possible. Not every application will support this and this is by no means(!!) a supportable solution, so don't even think of selling this to a customer or doing a company-wide deployment with it.
You have to launch the application you want to "host" first, then wait for it to create it's parent window. Once created, you have to use the Win32 API functions FindWindow, FindWindowEx, or GetWindow to get the window handle of the main form of the target application. Once you have that, you can call the API function SetParent[^] and the window handle of YOUR host window to re-parent the application window into your own form window. If you want to move that hosted window around in your form, you'll have to call the API functions, like SetWindowPos, to move it around and resize it.
KEEP IN MIND THAT THIS IS NOT A SUPPORTABLE SOLUTION!! IF YOU USE IT AND HAVE A PROBLEM, WE'LL DENY WE EVER TOLD YOU ABOUT IT!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
*grin* See, we didn't tell him that because we knew he would ignore the caveats.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hence, the very large disclaimer! :->
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks for your response. It's nice to get a response that that doesn't assume I'm an idiot. Seriously, was all the sarcasm necessary? I don't feel it's appropriate to belittle someone when they have a valid question. Of course I left out the details of viewing a pdf (I knew it was due to a COM component), but that doesn't mean I didn't know the details.
But thanks, Dave Kreskowiak. I will use your suggestion... and don't worry, this is just for my own computer.
John
|
|
|
|
|
Most people don't know about this little trick. Hell, I didn't know about until about 3 months ago. I've found it has limited uses, such as, what happens when the user quits the application? Test your code thoughly through every possible action.
The number of quality questions comming from people that "have a clue" is pretty low. I'd say the number of questions that we get from script kiddies, newbies, and wannabes, trying to do something WAY beyond their skills/understanding of Windows, is about 15x that of people who actually have any kind of clue about how Windows works. Next time, I'd recommend differentiating yourself from "the crowd" by putting a little blurb in about your experience and what you think you have to do to get something to work.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Good advice, thanks.
As far as your suggestion, SetParent works great for making a window a child of another window of the same application (for example, you can parent a notepad window within another notepad window), but it appears that cross-application parenting doesn't work with this method. Thanks for your suggestion though, I really appreciate it.
Any other ideas out there, supportable or not?
John
|
|
|
|
|
Like I said, it's of limited usefulness and doesn't work for all windows/applciations. But, it's the only solution out there. The only other way to do it is if the application you want to "host" has a COM component you can use.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|