|
Hi all
I have the following line of code
System.Array myValues = (System.Array)range.Cells.Value;
how can I convert the myValues array to string array?????
Thanks in Advance
|
|
|
|
|
Have you tried this:
System.Array myValues = (System.Array)range.Cells.Value;
myValues = (string [])myValues;
Nick Parker
|
|
|
|
|
yes Idid but it didn't work
What I did is I wrote a function that takes a System.Array variable as a parameter and returns a String[] array by converting the elements one by one.
it works but I would like to if there is a function to do that in one line of code.
|
|
|
|
|
JTJ should be lurking about, I'm sure he will have the answer. Good luck.
Nick Parker
|
|
|
|
|
string [] stringValues;
System.Array myValues = (System.Array)range.Cells.Value;
stringValues = new string[myValues.Length];
Array.Copy(myValues, stringValues, myValues.Length); That should work, let me know if it doesn't.
James
|
|
|
|
|
I didn't work. I got the following message
"The specified arrays must have the same number of dimensions."
cause the myValues is a 2 dimensional array.
when I replcaed the StringValues with 2 dimensional array
I got the following:
" At least one element in the source array could not be cast down to the destination array type."
this type is double data type.
I am still in this problem !!!!!!!!!!!!!!!
|
|
|
|
|
i want to have a dialog to get the directoryname that i choose.
i have already make one use DriveListBox, DirListBox and FileListBox.
code:
using Microsoft.VisualBasic.Compatibility.VB6;
using .........
namespace CustomerFolderDialog
{
public class FolderDialog : System.Windows.Forms.Form
{
....................
public string Path
{
get { return dirListBox1.Path; }
}
private string tempDrive;
……
public FolderDialog()
{
InitializeComponent();
tempDrive = this.driveListBox1.Drive;
}
……
private void driveListBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
try
{
this.dirListBox1.Path = this.driveListBox1.Drive;
tempDrive = this.driveListBox1.Drive;
}
catch(Exception ex)
{
MessageBox.Show(ex.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
driveListBox1.Drive = tempDrive;
}
}
private void Form1_Load(object sender, System.EventArgs e)
{
this.label1.Text = dirListBox1.Path;
}
private void dirListBox1_Change(object sender, System.EventArgs e)
{
try
{
this.fileListBox1.Path = this.dirListBox1.Path;
this.label1.Text = dirListBox1.Path;
}
catch(Exception ex)
{
MessageBox.Show (ex.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
}
}
but i don't like this.
i want its face like the "OpenFileDialog"
who can tell me how to it?
|
|
|
|
|
Hello everyone !!!
In so many applications, I have seen a button "Browse", which fires up a simple tree-based directory picker, a small pop-up window that allows a user to pick a directory and click either "OK" or "Cancel" buttons. There is a similar control in VB 6.0 called DirListBox.
However, I have not found anything like that in C# - and I thought that C# is great GUI language for Visual C++/MFC developers
Does anyone know ???
Thanks a lot in advance.
Kirill
|
|
|
|
|
you can use this control in c# after you install vb#.
you can see my code upstair.
|
|
|
|
|
Hello everyone !!!
In so many applications, I have seen a button "Browse", which fires up a simple tree-based directory picker, a small pop-up window that allows a user to pick a directory and click either "OK" or "Cancel" buttons. There is a similar control in VB 6.0 called DirListBox.
However, I have not found anything like that in C# - and I thought that C# is great GUI language for Visual C++/MFC developers
Does anyone know ???
Thanks a lot in advance.
Kirill
|
|
|
|
|
In visual C++,we use shell programming.
SHBrowseForFolder
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
How can I dial up and connect to internet with modem in my C# program?
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
You need to PInvoke InternetDial function.
|
|
|
|
|
Rama Krishna wrote:
You need to PInvoke InternetDial function.
Thank you for reply,but I can't find that function in MSDN.Could you please clarify it more.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
I see it in my local MSDN; make sure you don't have it filtered to show only .NET related items.
MSDN Website entry.
James
|
|
|
|
|
oh,yes.So agaian I have to use win32.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
I'll start with saying that it's somewhat difficult explaining exactly what
I am having trouble with, so bear with me..
My application loads an initial form (MainContainer). This form, uses
another class file (PAMenu) within the project to build & return an object
containing a control menu. The PAMenu contains all of the menu
construction, changes, and event handlers. It uses a 3rd party control
(MagicLibrary) to build the menu (giving it the OfficeXP/VS.NET menu
appearance). My problem is that I am having trouble accessing methods &
properties in the MainContainer form from the event handlers. Here's a bit
of code:
[MainContainer]
private PAMenu thePAMenu = new PAMenu();
appMenu = thePAMenu.Menu(); // builds the menu with default settings & display settings
Controls.Add(appMenu);
[PAMenu]
//this simply builds the menu and contains event handlers
//the internal menu object is called 'theTopMenu'
[MagicLibrary]
//this control overloads the MenuControl and MenuCommand objects
I have no problem handling events if they don't interact with the
MainContainer or it's child forms (such as the Exit handler running
Application.Exit()), but calling a public method within MainContainer just
isn't working. I've tried the following from within an event handler in
PAMenu:
this.theTopMenu.ParentForm
which gave me access to the default properties of the MainContainer form (I
was able to change the text in the titlebar), but I can't see my exposed
methods. The odd thing is that I can see some of the private properties
when stepping through intellisense.
Any ideas?
Andrew Connell
IM on MSN
andrew@aconnell.com
|
|
|
|
|
Just cast to you class:
(MainContainer )(this.theTopMenu.ParentForm).SomeMethod()
Jerzy
|
|
|
|
|
Or do this:
MainContainer mc=(MainContainer)(this.theTopMenu.ParentForm)
Then:
mc.SomeMethod()
mc.AnotherMethod()
Jerzy
|
|
|
|
|
I create a project it only a win32 empty project and add my class and main() function.
I used functions in SDK:
CreateThread();
FindFirstFile().....
When I compile and build the project. It always has linkerror:nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
How to solve this problem??
Thanks for any suggestion.
|
|
|
|
|
you need to make sure that your project is linking with this library, LIBCMT.LIB.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Anyone knows how to show a column in a bound datagrid as a linkLabel(hyperlink feature), when click it, can nevigate to somewhere?
Thanks a lot.
|
|
|
|
|
I'm creating an appliation that reads/writes from/to files that have the same structure as an INI file. Win32 includes a few methods to read/write keys, section, etc. I've tried to do this using C# but it could not compile. It inidcated that the methods I was using (e.g. GetPrivateProfileInt...)were not recognized or not included in any of the namespaces.
Does C# support the use of these functions? If so, under what namespace?
LA
|
|
|
|
|
http://www.codeproject.com/csharp/ini.asp
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
Hello,
This is my first C# project so you might find this question stupid
I have created a windows application and dropped on the form a sqlConnection and a sqlDataAdapter that uses the sqlConnection to connect to the database.
From the sqlDataAdapter (that maps to a specific table) I have created a DataSet via the wizard. Now I dropped a DataGrid on the form and set its DataSource and DataTable memebers correctly (I think at least, because I can see the column headers created from the dataset, and from the SQLDataAdapter I can preview my data correctly). Then in the constructor of my form I did
sqlDataAdapter1.Fill (dataSet11);
When I compile and run the app the datagid shows nothing but one single row and in the cells it says "(null)".
What do I do?
Best regards,
Alexandru Savescu
|
|
|
|