|
DataGridView1.Cells[i,j]
There is no Property "Cell" for DataGridView !
in any case , i want to say , how can we evaluate Cell Value , when It is Nul Or Empty ?
I want to stop in TabPage1 when Cell Value is Empty !
thanks!
|
|
|
|
|
True, my bad, confused with another grid like control.
dataGridView1.Rows[i].Cells[j] is the correct one. and your original one is ok too.
[edit]
On a closer look the logic is flawed as hell. I just took a quick glips at the code the first time.
Don't activate tabs inside the for loops.
Use a boolean, set it to true if something is empty, then ouside the loops do your thing
such as showing messageboxes, activating tabcontrols or what have you based on that boolean logic.
All the best,
Dan
|
|
|
|
|
Yes , Thanks , But How can we give an Error and Stop In TabPage1?
Regards!
|
|
|
|
|
First, don't add/remove tabs. An easier way is to just activate the needed one.
If you must, you could set the Visible property to false;
bool error=false;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 4; j++)
{
if (DataGridView1[i, j].Value == null || DataGridView1[i, j].Value.Equals(""))
{
error=true;
break;
}
}
}
if(error){
MessageBox.Show("something");
tabControl1.SelectTab("tabPage1");
}
else{ tabControl1.SelectTab("tabPage2");}
Note that SelectTab() also supports a int as a parameter, e.g. TabCtrl.SelectTab(0);
All the best,
Dan
modified 23-Nov-11 13:44pm.
|
|
|
|
|
|
I am familiar with the AOP program, PostSharp (for post-processing), though I don't use it, and I was wondering if the following scenario is possible at run-time:
1. you adorn certain classes and/or control definitions ... in a "main Form" ... with custom attributes.
2. at run-time, in the 'Load EventHandler of your main Form, or wherever: via reflection, I assume, the current executing "main Form" is parsed, and a new C# file is created on-the-fly which will define a new Form, into which identical copies of Classes and/or Controls ... in the main Form ... will be inserted ... based on the content of the custom attributes.
3. this new Form definition (assembly ?) will then be instantiated/created, and displayed.
4. if we assume that there is a pre-defined static class that enables access to certain Fields, etc. on the main form, will this new dynamically created form be able to access the content of that static class ?
Not looking for solutions, or code, here, just curious if this is "doable."
thanks, Bill
"... Sturgeon's revelation. It came to him that Science Fiction is indeed ninety-percent crud, but that also—Eureka!—ninety-percent of everything is crud. All things—cars, books, cheeses, hairstyles, people and pins are, to the expert and discerning eye, crud, except for the acceptable tithe which we each happen to like." early 1950's quote from Venture Sci-Fi Magazine on the origin of Sturgeon's Law, by author Theodore Sturgeon: source Oxford English Dictionary on-line "Word-of-the-Day."
|
|
|
|
|
This is doable, but would be a fairly complex application to pull together. Off the top of my head, what you would be looking at here is parsing a form using reflection (fairly trivial to accomplish), and pulling out attributes. Now, depending on the status of these attributes, you would probably need to parse the IL if you need to add an identical version in, and this would require you to Emit this into your newly created object (which you could create using the CodeDOM).
All in all, doable, but not trivial to implement.
|
|
|
|
|
Yes, it would be possible, however it seems like sledgehammer-and-nut territory: if you know enough from compile-time decorations to create a new form class, you know enough at coding time. And if you know how to build the code to make a new form, you know how to instantiate the new form and add controls to it at runtime. I don't see the benefit of creating a runtime type over doing that.
|
|
|
|
|
Hi All,
I am calling a c++ dll from c#. it throwing error like "An unhandled exception of type 'System.AccessViolationException' occurred in exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
[DllImport(@"D:\Project\Working\Toolkit-2.0\output\Win32\Debug\ipetk.dll",
EntryPoint = "?GetModuleTypeString@ModuleIndex@Infrastructure@IPETK@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ",
CallingConvention = CallingConvention.Cdecl)]
static extern string GetModuleTypeString(ModuleType ths);
string ModuleIndex = GetModuleTypeString(ModuleType.IPD);
MessageBox.Show(ModuleIndex.ToString());
how can i resolve this issue..? any help will be appriciated.
Thanks
G.Paulraj
|
|
|
|
|
This one must be in the declaration. What is the return type declared at on the C++ side? Are you sure it is defined as C call convention?
I suspect you need to marshal the string differently. See [MarshalAs][^].
|
|
|
|
|
Looks like the definition of your C function should be changed to something like:
extern "C" char* GetModuleTypeString(char*);
STL string s do not work well between managed and unmanaged code.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
The error message can also originate from a DEP (data execution protection) problem. If you get the error only when you run your compiled executable directly, but not when you debug from Visual Studio, set the DEP flag off:
editbin.exe /NXCOMPAT:NO "$(TargetPath)"
|
|
|
|
|
i have a string with data, i have to search the desired characters in that string by searching character by character and highlight them
Anyone please reply
Regards
phani
|
|
|
|
|
What is the exact problem?
What did you try already?
In what control are you showing the string?
What is highlighting for you?
V.
|
|
|
|
|
What he said.
- Nevin Janzen (thundercloudstudios.weebly.com)
|
|
|
|
|
1) i will take a text file with some data
2) then in the form page i have a "textbox" and a "button"
now i'l give a charcter in that textbox
3) when i click the button , i hav to search the character in the textfile and highliht the desired characteres with some colour in that text file
this is my Requirement
if you can , please send me the C# code for it
|
|
|
|
|
OK. First of all, I will not GIVE you any code. I will however try to help you on your way.
The textbox is the wrong control for this. You should use a richtextbox.
Look here[^]
Especially have a look at the properties SelectionColor, SelectionStart, SelectionLength, ...
Hope this helps.
V.
|
|
|
|
|
What's your favourite feature of C# 5.0 so far that has been announced?
- Nevin Janzen (thundercloudstudios.weebly.com)
modified 22-Nov-11 23:45pm.
|
|
|
|
|
the 5.0
All the best,
Dan
|
|
|
|
|
- Nevin Janzen (thundercloudstudios.weebly.com)
|
|
|
|
|
Asynchronous programming of course
|
|
|
|
|
I have a C#.net 2010 new application that I am writing where I use linq to sql so I can work with the datacontext object. On the first menu tab page, I update the 'main'table with default values and values the user enters. The user clicks the next button the user is allowed to change some values based upon when customers submitted work. Basically some of the dates that are loaded on the first page come off of a schedule due date table. If the customer submits various parts of the paperwork late, the user changes the dates in the database.
So the question is if a date was loaded into a sql server 2008 r2 datqabase, and the user finds that they need to change the value to NULL is that allowed? Basically on some of the paperwork that is supplied by the customer if they do not supply a date, the data needs to be set to NULL. Thus in the application how do I pass the null value to the database via the datacontext object? Do I pass the value as '' or 'NULL', or some other value?
Thus can you tell me how to pass this Null value to the appropriate column in the database?
|
|
|
|
|
Some suggestions here[^].
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi ,
How i Can open my c# form only automatically to user when user open windows.
|
|
|
|
|
You will probably need to add it to the registry in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run. But you may find that your users have their own ideas as to whether they want this to happen or not.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|