|
maybe like this?
string word1, word2, word3, word4 = "Hi";
|
|
|
|
|
no, I meant by writing the for loop is that I don't know the number
of variables at first. it varies...
I want to declare those strings without knowing the number of strings in the first place, and instead of using array, just declaring multiple variables.
|
|
|
|
|
The only way to do this is to use the array. What your trying to do NEVER has good reason to be done. There's always a FAR more efficient way to accomplish the same job.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
just asked out of curiosity...
|
|
|
|
|
I think you need Reflection for that...
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
|
string word1 = "Hi", word2 = word1, word3 = word1, word4 = word1, word5 = word1;
or
string word1, word2, word3, word4, word5;
word1 = word2 = word3 = word4 = word5 = "Hi";
or
string word1, word2, word3, word4, word5 = "Hi";
word1 = word2 = word3 = word4 = word5;
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
How do I trap the ctrlZ, ctrlc and ctrlv on a rich text box from executing when pressed. Please help
Nana
|
|
|
|
|
I believe the following should work, derive from RichTextBox.
protected override bool IsInputChar(char charCode)
{
switch ((int) charCode)
{
case 1:
case 3:
case 6:
case 22:
case 24:
case 26:
case 27:
case '\t':
case 8:
case 10:
case 13:
return false;
}
}
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
it not work.
thanks you for oyur help
Nana
|
|
|
|
|
Hi,
i am developing a custom control in C#.
I am coding the design time side of the control, but i have a problem.
I added some verbs to the control. Everything works fine in design time, but in runtime the code does not persist.
I add components with
mDesignerHost.CreateComponent(typeof(myComponent), name) as myComponent
where mDesignerHost is the IDesignerHost for the designer.
Only the creation of the component persists in runtime, but the rest of the code does not.
What's wrong?
|
|
|
|
|
What are the speed differences (if any) between using Textboxes,Radiolists, Labels etc to build a form as opposed to using a variety of custom controls to build the same form? (One of the custom controls would be, for instance, a label and textbox).
|
|
|
|
|
That depends on the quality of code in the custom controls. But, all thing being equal, there isn't any difference at all since both sets of controls will ultimately derive from the same base class, Control.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi All.
can any one help me, How to filter/sort records in a datagrid according to the values which I type in a text box,
my problem is i have a dataset populated and am setting it as data source to my grid.my requirement is i need to sort the grid at runtime as and when i type some text in a textbox (relates to a col in the grid), associated in the same form, and then after filtering i should be able to update the colums in the grid.
select query is to be performed once only, and i need to work with the availabe dataset to filter/sort records
|
|
|
|
|
Create a DataView from your DataTable and set that as the DataSource for your DataGrid. Then change the DataView.Sort based on the text in your textbox.
|
|
|
|
|
|
Hi all,
I have an Outlook Add-In that uses it's own shim for an AppDomain and often (don't you just hate it when that happens) Outlook acts strangely.
What does strangely mean? Two things mostly; On moving off in a email in the .pst file that mail is deliver to, the mail is not marked as read. Secondly when dragging a "still marked as unread even though I have read it" mail message from the folder it is in to another folder you get the message "Can't move the items. The item could not be moved. it was either already moved or deleted, or access was denied". Interestingly this message does get copied, it's just the delete afterwards results in the error. Deleting the message manually afterwards is fine.
I assume that my Add-In is being called and throwing an exception that is resulting in the delete after copy failing but I have stripped out everything that it has and it still happens.
Is there a way to get Outlook to tell me what is going wrong inside?
Thanks,
_Goose
|
|
|
|
|
Hi there.
I ran into some problems. I created a small form (f1) and on it there is a button. When the button is pressed a second form is created (f2) and springs up. I can´t seem to create a menu for this new form (f2). I also put a simple Label control on f2 just for fun. I put some code into the eventhandler for the button but then all I get when the button is pressed is a menu on the underlying form (f1), not on f2 like I intended
Here is what happens when the button is pressed:
Form f2 = new Form();
f2.Show();
f2.BackColor = Color.White;
Label pa = new Label();
pa.Text ="Just for fun";
pa.Location = new Point (40, 110);
f2.Controls.Add(pa);
MainMenu MyMenu = new MainMenu();
MenuItem m1 = new MenuItem("File");
MyMenu.MenuItems.Add(m1);
MenuItem subm1 = new MenuItem("Hello");
m1.MenuItems.Add(subm1);
subm1.Click += new EventHandler(menu_selected);
Menu = MyMenu;
Can someone please help me ?
FJ
|
|
|
|
|
naglbitur wrote: Menu = MyMenu;
You are adding the menu to the form that contains the event handler there. Try:
f2.Menu = MyMenu;
|
|
|
|
|
It works, thanks a lot
FJ
|
|
|
|
|
Hi, I want to create a setup project. My c# project uses a Microsoft Access Database. Som how and where should i add this database file to my setup project so that the setup will then work?
Thanks!
|
|
|
|
|
You need to add it to the files you want to install. You can select the Files view through the project explorer (some buttons at the top of this explorer).
Be sure that the application loads the database from the directory it is running from (the application directory )
WM.
What about weapons of mass-construction?
|
|
|
|
|
Hi,
I can translate my application using the procedure described in the MSDN article 'Walkthrough: Localizing Windows Forms'. In that article, one one language is set, by instantiating a CultureInfo() in the constructor of the from and setting it on the current thread's CurrentUICulture.
But now, how do I dynamically (at run time) change the language that the UI is show in? I've tried calling InitializeComponent() after setting Thread.CurrentThread.CurrentUICulture but that doesn't work. I know I can have the user close the application and restart it so that I can set the correct CultureInfo() at the start of the program, but is there another way? Thanks.
cheers,
roel
|
|
|
|
|
You can set the currentculture property of the thread your in.
Thread.CurrentThread.CurrentCulture = New CultureInfo("nl-NL", False)
|
|
|
|
|
Hi,
Thanks, but that only works when doing it before the UI is created. I'd like to change the language of the labels, buttons etc. while the application is already running (through a menu option).
cheers,
roel
|
|
|
|
|