|
HI
i have a DataGridView & i like to insert into one of his rows a control
for example i tried :
ComboBox com = new ComboBox();
for (int i = 0; i < 5; i++)
com.Items.Add(i.ToString());
object[] row1 = new object[] { com };
dataGridView1.Rows.Add(row1);
but it display the control string information
if anyone can give me alead ro a new lead (maybe i am at the wrong way)
THNKS
P.S : what kind of controls i can insert
kobkob
|
|
|
|
|
HI,
OOPS, i found out how
thanks anyway
kobkob
|
|
|
|
|
Hi
I have 2 listboxes on my form and in the form load event I want to get values from specified registry keys to appear as items in to each listbox. The first listbox works fine using this code:
RegistryKey key1 = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\RegKey_test");
if (key1.GetValue("MultiString1") != null)
{
ListBox1.Items.Clear();
string[] items = (string[])key1.GetValue("MultiString1");
for (int i = 0; i < items.Length; i++)
{
ListBox1.Items.Add(key1.GetValue("MultiString1", items[i]));
}
}
But for the second listbox I have practically the exact same code (But with a different registry value name and listbox). However, when the form loads ListBox1 shows the correct values but ListBox2 shows 'String[]Array' for each number of multistring values. Here is my code for getting the values from "MultiString2" into ListBox2:
RegistryKey key2 = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\RegKey_test");
if (key2.GetValue("MultiString2") != null)
{
ListBox2.Items.Clear();
string[] items = (string[])key2.GetValue("MultiString2");
for (int i = 0; i < items.Length; i++)
{
ListBox2.Items.Add(key2.GetValue("MultiString2", items[i]));
}
}
Why do I have this error when both sections of code are not that different? Can anyone advise me please?
Lucy
|
|
|
|
|
I have tried changing ListBox2.Items.Add(key2.GetValue("MultiString2", items[i]));
to
ListBox2.Items.Add(key2.GetValue("MultiString2", items[i].ToString));
But the same problem occurs. All registry key and value names are correct.
Stepping through the code I can see that the value for ListBox1.Items is {System.Windows.Forms.ListBox.ObjectCollection}
Should the listbox items be an ObjectCollection?
Lucy
-- modified at 8:03 Friday 28th September, 2007
|
|
|
|
|
Lucy_H85 wrote: string[] items = (string[])key2.GetValue("MultiString2");
for (int i = 0; i < items.Length; i++)
{
ListBox2.Items.Add(key2.GetValue("MultiString2", items[i]));
}
You already got the list from the registry in the first line, then you go and get the list again, and again, and again, and again, and again, for each and every pass through this loop. There's no need to do that. You already have the list in a string array you chose to ignore.
string[] items = (string[])key2.GetValue("MultiString2");
for (int i = 0; i < items.Length; i++)
{
ListBox2.Items.Add(items[i]);
}
|
|
|
|
|
Hi all,
I have an urgent question.
I am writing an windows service to retrieve files from a network drive mapped as Y: I get the following error... Could not find a part of the path "Y:\verify".
When I run an Application it works fine, so I tried to shell the exe from my service, but still get the error!
I have read and tried several things but to no success
Can anyone please assist me?
|
|
|
|
|
The network drive is mapped to a particular user (yours I presume). It is highly unlikely that you are using your user for the service, so it won't be able to see the mapping because this is not present for the user. Your choices are:
1. Rewrite your code to use the UNC path.
2. Change the user of the service to your user.
3. Add the mapping to the user that the service runs against.
Option 1 is your best option (oh, and don't hardcode the value - pick it up from a config file so that you can change it later on.)
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanx for the quick reply
If I use Option 1, the share uses Authentication. It's basically a DMZ share...
How can I then authenticate the service?
If I use Option 2, I have tried to set the Log On of the service to my domain logon, thought it would then see my mapped drive???
Under which ServiceAccount type should I install the service?
Any advice here?
|
|
|
|
|
This is most likely because your service is running under the local account. A local account is just that - local. You can either configure the service to run with a specific user's credentials (I've done this and it works) or use a UNC path (I haven't tried this, so I don't know).
Cheers,
विक्रम
And sleep will come, it comes to us all
And some will fade and some will fall
|
|
|
|
|
Hi thanx for the reply!
I ran the service using my domain login, I thought that this will allow the service to see MY mapped drives. But still got the same error.
Under which ServiceAccount should I then install,localService, Network Service?
Please assist this is of great importance
|
|
|
|
|
|
Mapping drives is so '80s; use a UNC.
|
|
|
|
|
the '80s were great, so mapping drives also
|
|
|
|
|
Mapping isnt so 80's when having to interface with DOS
|
|
|
|
|
hi all,
i use ShowWindow(hWnd, SW_HIDE); in order to hide a running windows application.
it works good. and hide any application i want. (for example notepad)
(after calling that fuction the app is not seen in taskbar any more but available in task manager - still running in background)
the problem is:
i cant bring that process back with using ShowWindow(hWnd, SW_RESTORE);
what should i do in order to bring the hidden process back to the foreground ?
any ideas ?
thanks in advance.
MFA
|
|
|
|
|
Try ShowWindow(hWnd, SW_SHOW); instead.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Message Closed
modified 27-Apr-15 11:15am.
|
|
|
|
|
The problem that you have here is that MainWindowHandle is 0 because the window is hidden. To get round this, save the window handle that you used to hide it and pass that into ShowWindow instead of the MainWindowHandle .
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Message Closed
modified 27-Apr-15 11:15am.
|
|
|
|
|
Excellent. Glad to be of service.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
We are planning to rewrite out data access layers in framework 3.0 (currently its is Framework 1.1). We are using DataSets throughout for data access, and also while passing data from Data Layer to other layers.
I have to find out alternative data containers, because DataSet would consume lots of memory because mostly we may have to fetch a few rows and for that we don't want to use a DataSet. DataTable could be an alternative, but I wanted to know if there are other data efficient data containers in new .NET Framework, or another method of data access.
I am doing my research on google, still it would be great if someone could point me in the right direction.
Regards,
Blumen
|
|
|
|
|
Not really, your other options are to pass XML, or to create collections of your entity objects in your data layer, and pass those out.
Of course, they are passed by reference, anyhow.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thank you for that response.
Can I avoid DataTable and DataSet if I use xml?
|
|
|
|
|
You could, but it you be a nightmare to manage. XML is best used as a transfer mechanism, not as a storage mechanism.
If you were to use XML you would have to convert everything into it, including converting numbers to their string representations. If you need anything out of it you have to parse the strings back into their original representation. That takes time.
Have you considered some alternative patterns like DTOs (Data Transfer Objects) - These are lightweight objects that hold some data. It you want to represent a table you can create a collection of DTOs.
An example of a simple DTO:
public class PersonDTO
{
public int PersonID;
public string FirstName;
public string Surname;
public string MiddleNames;
public DateTime DateOfBirth
} Although it would be preferable if you created the fields as private and created property accessors for each of the fields.
|
|
|
|
|
Hai Everybody,
Can any one tell be how to program with the Exchange Server 2003 in C# with the help of API's.
Best Regards,
M. J. Jaya Chitra
|
|
|
|