|
hi,
you can use a DataGridView contorl.
Example for you're list like this:
dataGridView1.Columns.Add("column1", "Column1TextToDisplay");
dataGridView1.Columns.Add("column2", "Column2TextToDisplay");
foreach (string[] param in Param)
dataGridView1.Rows.Add(param);
Pretty easy, huh ?
Cheer's,
Alex Manolescu
|
|
|
|
|
Thank you!
It works great, something I can really build on in my project.
Douglas
|
|
|
|
|
You're welcome. Don't forget to rate my reply
Cheer's,
Alex Manoelscu
|
|
|
|
|
I know of two ways to get a ListBox show tabular stuff as you would like it:
1.
use a non-proportional font, such as Courier New (for logs, numbers, etc that is what I do);
2.
make it OwnerDrawn, i.e. provide a DrawItem handler, where you do a Graphics.DrawString() for each of the "columns"; that is what I do when I want one or more columns to use proportional fonts, and/or want to include non-textual information such as icons.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Hi,
I'm new here, and just recently I've been trying to make a program that modifies some registry keys. Don't worry, this isn't malicious. And this is the first time I've coded in quite some time... so i am rusty.
Here goes, I want to automate changing the status of an audio device from enabled to disabled. The issue lies in I get kicked back when using the RegistryKey.OpenSubKey method when I try to have write access. When I get read access, it does open but then I can't change the DeviceState value to disable the device. I have tried using both RegistryPermission & RegistryAccessRule... I had luck with neither. I also went as far as creating a batch file that used "subinalc.exe" to take ownership of the key and then attempt to open it... still nothing.
I tried googling this, but I haven't found anything that proved useful. So my question is, is there a class I could be using that would let me take possession of the key? Or is there another class to set permissions that I haven't found?
I am running VS 2008, and I have tested on two different Win 7 systems (one x86 & one x64).
|
|
|
|
|
From Vista onwards certain parts of the reigistry require the application to be elavated. Adding an application mainfest file and requiring administrator as described here[^] may solve your issue.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I forgot to add that in the original post. I already created the manifest requiring an elevated status.
|
|
|
|
|
OK, if the used doesn't have an admin account, it's not going to work no matter what you do. Virtually everything under HKEY_LOCAL_MACHINE is read-only to normal user accounts.
What's the pat you're trying to write to?
|
|
|
|
|
From within the registry editor there is a permissions window Edit->Permissions which allows you to assign permission to users for keys.
|
|
|
|
|
I'd be very grateful for some help.
My project is as follows:
The user can enter a choice of pizza type; thin crust, medium and thick crust.
Then they can choose the size between 100mm and 1000mm.
The thin crust has a base price of £2.50, the medium £5.00 and the thick £7.50.
Then I need to calculate the size of the pizza selected, add the base price, and let the user confirm their selection.
The confirmed selections have to be appended to a text file with a date stamp. The file should keep adding confirmed records every time the program is run. (crust type, size, cost, and date)
I am still battling with the basics, and hopefully getting on with this project will help.
So far my code is:
string[] size = new string[3];
size[0] = "thin crust";
size[1] = "medium crust";
size[2] = "thick crust";
Console.WriteLine("Enter type of pizza required: 1 = thin crust, 2 = medium crust, 3 = thick crust: ");
int result = int.Parse(Console.ReadLine());
Console.WriteLine("You have chosen the {0} pizza", size[result - 1]);
Console.ReadLine();
}
areaM2:
{
float x;
Console.Write("Please enter number, between 100 and 1000: ");
x = float.Parse(Console.ReadLine());
if ((x >= 100f) && (x <= 1000f))
{
Console.WriteLine("Your number {0} is between 100 and 1000", x);
Console.ReadLine();
}
else
{
Console.WriteLine("You did not enter a valid number: ");
Console.ReadLine();
goto areaM2;
}
}
size[0] = 2.5;
size[1] = 5;
size[2] = 7.5;
x = x * x;
Console.ReadLine();
It would run until I added the last few lines. If someone could tell me how to proceed by assigning the base prices to the sizes, and adding them to an equation, I would be very grateful.
Thanks to those people who helped me earlier, but I think I posted in the wrong place, sorry.
|
|
|
|
|
You put the declaration of x in a "weird scope which is there without reason", so it disappeared by the time it gets to the x = x * x
Solution 0: remove the useless scope
Solution 1: move float x outside the scope
Solution 2: move the calculation inside the scope
btw you should probably change that nasty goto into a do-while
|
|
|
|
|
Ok, there are a couple of problems here!
1) DON'T USE GOTO! Replace that with a "while" loop, and use a bool to control continue around / exit (there are other ways, but that is simple to do and understand). Never use GOTO until you are experienced enough to know when you should!
2) You have declared "size" as an array of strings - you cannot then use it as an array of floats. That is like making space on a bookshelf then trying to store car engines - it doesn't work. Create a new array of floats, or use an if...else if...else instead.
There are other (future) problems, such as what happens if the user enters a pizza type of -1, or 6 - but they can wait until the main logic is sorted.
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
I've improved the code I think:
string[] pizza = new string[3]
{ "Thin Crust",
"Medium Crust",
"Thick Crust"};
Console.WriteLine("What type of pizza do you want? Enter number, ");
for (int i=1; i<4; i++)
Console.WriteLine("{0} {1}",i,pizza[i-1]);
int result = int.Parse(Console.ReadLine());
Console.WriteLine("You have chosen the {0} pizza", pizza[result - 1]);
Console.ReadLine();
float x;
Console.Write("Please enter pizza size, between 100 and 1000: ");
x = float.Parse(Console.ReadLine());
if ((x >= 100f) && (x <= 1000f))
{
Console.WriteLine("Your number {0} is between 100 and 1000", x);
Console.ReadLine();
}
else
{
Console.WriteLine("You did not enter a valid number: ");
Console.ReadLine();
I've played around and can't figure out how to get the 'do,while' to work when entering invalid figures
|
|
|
|
|
|
can I really order pizza's from you, with diameters that are millimeter accurate, and go all the way up to one meter? Do you do home delivery? And are they free when undelivered within 30 minutes, as is the general rule over here? I'm interested! Please send me menu and contact info...
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Hi Dears
I want to display image from sql server in crystal report using c#
I create an Image field in my table and binded to crystal report but dosen't display iamge when run the program
Can anybody help me?
|
|
|
|
|
I have a WinForm application that occasionally creates a range of Controls at runtime (buttons, labels and so on) always setting precise sizes and fonts for them. Everything runs finely in normal DPI (96) but if I switch to high DPI (125%) all the controls are wrongly resized showing clipped text.
I tried using the DPI Aware function, both in manifest and DLL, but with no success (apparently nothing changes).
All want to do is prevent Windows from resizing the controls, I just want to disable this whole DPI resizing thing. Is that possible?
|
|
|
|
|
|
Hi all,
I am using biztalk 2009 and sql server 2008, vs2008.
any information is greatly appreciated - I am not able to find any tutorials or articles on how and where to start
I need help on figuring out how to do the following. I have csv file which I am able to map to sql server tables using updategrams and I am successful in importing the data to respective fields in multiple tables. (If the data in csv file is clean and straightforward then everything is smooth - but the system I am developing is a bit complex)
now I need to do validation on the data that is coming in
1) I need to retreive the csv file name into a attribute in flat file schema and retreive a part of the filename and parse it into the sql server table field.
2) I need to check if the data coming from csv file already exists (if yes then dont insert that Customer record and only update that customer's information)
3) validation for datatypes , length,spaces, -this all I cannot do in the map through functoids (In the map I can only check for schema mapping - if the schema matches or not -how can i do this)
4) where and how to do data validation in biztalk - so that correct data is imported to sql server (How to seperate schema validation from data validation in biztalk)
thanks
|
|
|
|
|
I know nothing about BizTalk. Unless I write a custom utility for loading particular data I use bcp to do it. When I use bcp I load the raw data into a holding table and then use triggers to further process it into the destination tables. You might be able to do that sort of thing with Biztalk.
|
|
|
|
|
Form has two multiline text boxes and one button. I am using a foreach loop to read each word in a input textbox and put the output for each word in a textbox called outputtextbox.text and append some text to it. The program works perfectly, except the output in the output textbox only gives me the last word from the input textbox. I set a breakpoint on the foreach and stepped through the code and I can see that each word is being read. However, the output is only displaying one word, the last word. Ie) (This is not real code)inputtextbox = bears cats dogs and user hits the submit button, only dogs with the appended text will be displayed. It's as if the output textbox is being overwritten. Can anyone please give me any pointers to display all the words on seperate lines in an output multiline textbox. Thank you so much. I would really apprecaiate the help.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace ForEachTester
{
public partial class ForEachForm : Form
{
public ForEachForm()
{
InitializeComponent();
}
string sentence = "";
string SingleWordHolder = "";
private void Submitbutton_Click(object sender, EventArgs e)
{
sentence = InputtextBox.Text;
foreach (string word in sentence.Split())
{
SingleWordHolder = word;
//supposed to append text and output each word on
//on a seperate line in the output multiline text box.
OutputtextBox.Text = ("abo" + SingleWordHolder + "nvo");
}
}
}
CodeRed
|
|
|
|
|
Well, without looking at it too closely, this line:
OutputtextBox.Text = ("abo" + SingleWordHolder + "nvo");
will just set the text to the last value of SingleWordHolder in the loop. Presumably you want something like:
OutputtextBox.Text += ("abo" + SingleWordHolder + "nvo");
probably with a '\r\n' in there to get newlines.
Regards,
Rob Philpott.
|
|
|
|
|
Firstly, when you post code snippets, use the "code block" widget to preserve the formatting.
Your code would have looked like this:
namespace ForEachTester
{
public partial class ForEachForm : Form
{
public ForEachForm()
{
InitializeComponent();
}
string sentence = "";
string SingleWordHolder = "";
private void Submitbutton_Click(object sender, EventArgs e)
{
sentence = InputtextBox.Text;
foreach (string word in sentence.Split())
{
SingleWordHolder = word;
OutputtextBox.Text = ("abo" + SingleWordHolder + "nvo");
}
}
}
} Which is lot easier to look at and work out what is happening!
Your problem:
Every time you go around the foreach, "word" becomes a single word in a string. So if "sentence" was "hello there this is a test" before the foreach, it would go round the loop 6 times, with "word" being each word in sequence: "hello", then "there", "this", "is", "a" and finally "test"
Since you add the strings "abo" and "nvo" to "SingleWordHolder", and then assign he output text box to that each time, all the happens in the end is that the Outputtextbox.Text holds the final word "test", bracketed by "abo" and "nvo".
Try replacing = with += and see what happens!
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
FYI: when output is line-oriented I prefer a ListBox over a TextBox almost every time.
A ListBox does not need the lines to be concatenated at all, it just shows a list of items.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Hi all developers,
I have spent a lot of time to find a fast way for converting a stream of jpg images to bitmap format in c# (to use in a n image processing unit in my application). The conversion in my code is done as follows:
using (MemoryStream ms = new MemoryStream(imageBytes))
{
this.bqi.Bitmap = new Bitmap(ms);
}
in these code lines, imageBytes contains jpg image data ready to convert to bitmap format. These images are coming in from an IP camera as a web server. The frame rate is 15 frames per second, and converting 15 frames per second to Bitmap in this way takes too much time of CPU and the application is almost unable to do any other job when preview is on.
Is there any workaround for this conversion without need to much cpu usage? Is there any solution on using directshow for converting jpg to bmp on gpu?
any suggestions appreciated.
thanks in advance
----------
Eric(M.M)
|
|
|
|
|