|
For another webpage, I wanted to display only the questions in datagrid.
So i seperated it into 2 columns to make it more simple for me to call.
fire85
|
|
|
|
|
None of this makes any sense. You have two columns, but when you do a query, they both get checked for the SAME value ( the value of i ). how does that make it simple ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
But if put together in 1 column i dont know how to seperate it out when i need to display just question only. So i make it in this way.
But now think of it, when calling the questions will also be troublesome too
I will work on my database for better calling
Thanks alots, Sir Christian Graus.
|
|
|
|
|
fire85 wrote:
But if put together in 1 column i dont know how to seperate it out when i need to display just question only. So i make it in this way.
ARGH !!!!!
IF THE CODE YOU POSTED IS CORRECT, THEN THESE COLUMNS ALWAYS HAVE THE SAME VALUE FOR EACH ROW, SO THE SEPERATION IS WORTHLESS !!!!!!
Now. If you do a SELECT * from this table, do those two columns always have the same value per row ? If not, then your code is wrong. If so, then your database design is ridiculous.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Sorry just found out is because of the design of my database (just did some testing) so i cant display others data.
Thanks alot for your time
fire85.
|
|
|
|
|
how do i add advanced properties in a usercontrol ?
someting like
ImageList.Images shows Image Collection Editor
or ListBox.Items shows string collection editor...
|
|
|
|
|
CiNN wrote:
how do i add advanced properties in a usercontrol ?
The more advanced they are, the more code you need to write. You're completely in control, and completely responsible for writing the implimentation. If you want more specific info, ask a more specific question.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i need access to store some images in an imagelist in my usercontrol
|
|
|
|
|
Oh, OK. Can't you just add a property that exposes the images in the imagelist ? Or are they not there as a collection ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi
I'm trying to run g++ using process.start, but it fails to wait for it to exit. what need I do?
cheers
|
|
|
|
|
thepersonof wrote:
I'm trying to run g++ using process.start, but it fails to wait for it to exit. what need I do?
Have you tried Process.WaitForExit[^]?
|
|
|
|
|
thanks
atm i'm using:
ProcessStartInfo oStartInfo = new ProcessStartInfo();
oStartInfo.FileName = dir+"g++.exe";
oStartInfo.CreateNoWindow = true;
oStartInfo.UseShellExecute = false;
oStartInfo.Arguments = ".......";
Process p1 = Process.Start(oStartInfo);
p1.WaitForExit();
cheers
|
|
|
|
|
Since you're hiding the window and not using ShellExecute, you have no way of knowing if the app actually launched properly. Some applications don't tolerate NoWindow and/or must be executed using the Shell.
Also, some applications will start with their own "wrapper", where you launch one .EXE and it in turn, launches a second one to do the actual work while the one you launched quits.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks, the same thing happens, though, even when they are not used.
cheers
|
|
|
|
|
Ok I'm new to Windows development. I have a project that has 2 forms. A button on form1 opens an instance of form2. Form2 has a textbox that receives some data. I try to make that data available to form1. I have tried several things but keep running into problems. What is the proper way of making data inputted on different forms available to all forms?
|
|
|
|
|
Hi,
The best way is probably to have form 2 raise an event, whose argument will contain that piece of data you are trying to transfer. Then you will have form 1 subscribe to that event.
Hope that helps,
Yigal
|
|
|
|
|
This event stuff may be overkill unless you want the first form to display live updates of what is going on on the second form. Also, it would be a bit of a mess to onroll all the changes if the user ended up clicking "cancel" after a lot of changes.
More likely, you just want the same kind of behavior you get with the OpenFileDialog, SaveFileDialog, FontDialog, etc. In that case, you just add some public properties to your second form that can be initialized and retrieved from the first. You'll probably care about whether the user clicked "ok" or "cancel" on the second form, so you'll probably want to use the DialogResult stuff. (unless your second form has some other idiom, like those dialogs that only have a "close" button).
Hopefully this is enough info to get you started. This question is asked so often, I was thinking of writing a little article to describe a couple ways to do it simply, as well as the more advanced event method mentioned above. Or probably there is already an introductory forms article that covers it...
Matt Gerrans
|
|
|
|
|
Yes, this is what I want to do. I have been looking at events and they seem to be more for errors or events rather than passing data. I could not find an article just questions so if you have time a simple example would be great.
|
|
|
|
|
Here's a minimal example, without validation, etc.
Snippet from the main form (extraneous stuff omitted):
class MainForm : Form
{
private string chosenPizza = "Pepperoni";
private bool cheesy = true;
private void buttonChooseNewPizza_Click(object sender, EventArgs e)
{
PizzaOrderForm orderForm = new PizzaOrderForm();
orderForm.PizzaType = chosenPizza;
orderForm.Cheesy = cheesy;
DialogResult answer = orderForm.ShowDialog(this);
if (answer == DialogResult.OK)
{
chosenPizza = orderForm.PizzaType;
cheesy = orderForm.Cheesy;
labelOrderStatus.Text = "Your " + chosenPizza + " pizza with" +
(cheesy ? "" : "out") +
" cheese is coming right up!";
}
}
}
And from the sub-dialog form:
partial class PizzaOrderForm : Form
{
public PizzaOrderForm()
{
InitializeComponent();
}
private string pizzaType;
public string PizzaType
{
get
{
return pizzaType;
}
set
{
switch (value.ToLower())
{
case "pepperoni":
case "hawaiian":
case "vegetarian":
pizzaType = value;
break;
default:
throw new ArgumentOutOfRangeException(string.Format("Sorry, {0} pizza is not on the menu.", value ));
}
}
}
private bool cheesy = true;
public bool Cheesy
{
get
{
return cheesy;
}
set
{
cheesy = value;
}
}
private void PizzaOrderForm_Load(object sender, EventArgs e)
{
textBoxPizza.Text = PizzaType;
checkBoxCheese.Checked = Cheesy;
}
private void buttonOK_Click(object sender, EventArgs e)
{
PizzaType = textBoxPizza.Text;
Cheesy = checkBoxCheese.Checked;
}
}
Also, the OK and Cancel button's DialogResult properties should be set accordingly.
(If you're using .NET 1.0 or before, don't be confounded by the partial class, it just lets the form designer do all its code generation in a separate file).
Matt Gerrans
|
|
|
|
|
Do one thing Take a Global Module and Decalre a variable which is of type public. and Assign the Textbox value to that .U can access that Variables value from any form.
Deepak
|
|
|
|
|
Please don't do this, for your own sake. It may seem simple and clean at first, but you will surely regret it as your app grows.
Even the solution I gave above is not ideal; the data should probably be encapsulated in some objects, which could be passed from one form to the other (not by events, but in the same way I did with individual variables).
Matt Gerrans
|
|
|
|
|
Hi guys,
I have created a Visual Studio setup project, and when I build it I get a .msi installer file. Does anyone know how to create a single .exe installer file, or how to convert a .msi file to an .exe file that can be downloaded? Thanks.
|
|
|
|
|
Why don't you want an .MSI?
|
|
|
|
|
Hi,
I have nothing against .msi files... I'm just wondering why every file I download off the web is .exe and never .msi, and if there is any advantage to using .exe. What do people use to create an .exe file?
Yigal
|
|
|
|
|
Hi,
When I create a context menu with C#, only the left button can select entries in the menu (AFTER the menu has been invoked by a right click). Does anyone know how to enable selection using the right button, like the way it is in most Windows applications?
Thanks.
|
|
|
|