|
Or was it 3 rights... I can never remembers...
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
|
Ba-doom ching! IThankyaw!
|
|
|
|
|
Write your own API and/or framework -- but I don't recommend it, I suggest you use .net instead.
|
|
|
|
|
How we can make a component ?
I want to make a component whit a classlibrary not with usercontorols?
|
|
|
|
|
Simply write something and call it a component.
|
|
|
|
|
|
No, there's no reason to do that; I can create whatever I like and call it a component. I can have an enum that's a component of my Widget facility.
|
|
|
|
|
|
hi. i can't find the index of items in CheckListBox in my program.
mean's that i write the code like this and i have access to the vales but i can not find their index.
string[] arr;
for (int i = 0; i < CheckedListbox1.Items.Count-1; i++)
{
arr[i] = serviceExtenderList.CheckedItems.ToString();
}
may i ask a little guide for that?
|
|
|
|
|
To get a list of selected items in a CheckedListBox , try something like
foreach(object itemChecked in checkedListBox1.CheckedItems .
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Hi,
not sure what it is you are trying, however here are some ideas:
1.
you can't insert elements in an array when the array hasn't been created yet. Maybe you are missing a statement along the lines of: arr=new string[CheckedListbox1.Items.Count];
2.
I wonder why you would store a range of numbers in a string array in the first place. Strings are often abused; the general recommendation is to use actual types, not strings, where ever possible.
3.
A CheckedListbox has some properties that directly identify the checked items; see CheckedItems and CheckedIndices.
4.
Most often a generic list is a handy substitute for an array, as you don't need to set a size at the start, you can just add to it at will.
5.
If you aren't familiar with it yet, make sure you read up on the foreach statement. It works well with arrays and lists alike.
|
|
|
|
|
hi,
everybody,
I would like to get source code for datagridview events.
I have already implemented with datagridview in windows application.
When user enter in datagridview's cell 2 eg, dgvSale["ItemCode"] , I want to set cursor in cell 4(4,CurrentRowIndex).
and then user entry the qty and type enter in cell(4,CurrentRowIndex). Again, I want to set cursor in cell 5(5,CurrentRowIndex)
Please let me know which event is suitable for me.
with regards,
ToeToeAung
|
|
|
|
|
toetoeag wrote: Please let me know which event is suitable for me.
Not an event, but a method that you need. A few, actually;
dataGridView1.CurrentCell.Selected = false;
dataGridView1.Rows[CurrentRowIndex].Cells[4].Selected = true;
dataGridView1.CurrentCell = dataGridView1.SelectedCells[0];
dataGridView1.BeginEdit(false);
Enjoy
I are Troll
|
|
|
|
|
I cannot get my environment variables to return a value in the message box in this example, but it works fine with things like "ipconfig" ... any idea as to why?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string testSession = ExecuteCommandSync("sessionname");
MessageBox.Show(testSession);
}
public string ExecuteCommandSync(object command)
{
try
{
System.Diagnostics.ProcessStartInfo procStartInfo =
new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = false;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
string result = proc.StandardOutput.ReadToEnd();
return (result);
}
catch (Exception objException)
{
return("failure");
}
}
}
}
modified on Friday, December 3, 2010 4:50 PM
|
|
|
|
|
Strangely enough when I do this through a console app it works and when the environment variable changes I cannot see the change until I close the program and reopen another instance of it? Then it displays the change in the environment variable. Why is that?
|
|
|
|
|
Where in your code sample are you reading an environement variable? When asking why something is broken, show us the broken thing that is applicable, not some other thing that works fine.
You do understand that each cmd process has its own environment right?
|
|
|
|
|
I am asking for sessionname
I had to replace ipconfig with sessionname in my original post, sorry about the confusion.
|
|
|
|
|
Like T M Gray said already... Where are you actually getting an environment variable in this code?
And if that's your goal, why not just do it the easy way?
string something = Environment.GetEnvironmentVariable("something");
Not really sure what launching command-line processes and redirecting I/O has to do with environment variables...
|
|
|
|
|
Hi,
I tried that, and when I have a form that has a button/messagebox to check that and then display it, it keeps displaying the outdated variable value?
|
|
|
|
|
Because if you define a variable in another process, it won't exist in this one.
|
|
|
|
|
Hi,
I'm not setting it, it will change by the OS ... but when I call it after the change it still does not display the new value?
|
|
|
|
|
How are you checking the value?
I'm not sure if this changed in the latest versions of Windows, but usually environment variables are initialized with a copy of the OS environment variables when the process starts. While the process is running, any changes in environment variables via the OS would not be seen by the process and any changes made to variables in the process will not be passed back to the OS.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Hi Walt,
I've checked it both with the code above and by just calling the environment variable with a get environment variable call.
Both times the code will not reflect the change until I restart the application I am building.
I know the variable is changing though, because I can open a cmd prompt and type %sessionname% and it will reflect whether I am logged in locally or via console mode.
I tried to keep spawning a new cmd prompt window within a form, so that it would close and then reopen the window and write the %sessionname% value, but closing the cmd window seems to kill my do while loop and I couldn't get around that even after 3 hours of trial and error
|
|
|
|
|
Yes, that's what I would expect.
The environment variables in your process and the OS and any other process are meant to be totally independent so that total chaos in the OS won't ensue. When you spawn your process (cmd window, etc.) it starts with a copy of the owner's environment variables, but any changes it makes are local to your process (cmd window) and any changes made in another process (a new cmd window or the OS) will not be seen by your process. I think you have confirmed that that's exactly what is happening.
If you need to pass changeable information between processes, environment variables are not the solution. They are meant to be used for more or less static system information.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|