|
I have a data grid viewer populated from a SQL Server stored procedure which returns any number of columns from a minimum of 4 to a maximum of unknown columns.
I need to have the ability to print the entire grid.
This I can do.
However, to print the grid to specifications
-- I need to be able to print it on pages the size of 42x36 and 72x72.
-- I need to be able to visually scale the entire grid to one page?
Please help. what needs done for this ability?
|
|
|
|
|
Hello. I'm trying to get something like when a user inputs B, he gets back ß. I'm using
string b = "ß";
string what1 = Console.ReadLine();
if (what1 == "b")
{
Console.Write(b);
}
and it doesnt seem to work. Any Help?
modified on Friday, November 20, 2009 8:43 PM
|
|
|
|
|
What do you mean by "it does not work"? You need to be more specific in order for us to try to help you.
The fact that you're writing to the console leads me to believe you're seeing a block character instead of β. That's probably because the console font being used is incapable of rendering anything other than a limited character set.
/ravi
|
|
|
|
|
Nope, it can print the "ß" (Double S sound in German)
But what I want is, when someone Enters the character "b" it prints "ß"
But its just not printing anything when I type b.
|
|
|
|
|
Console.ReadLine() returns only after a newline character is entered.
/ravi
|
|
|
|
|
Hi,
From the MSDN documentation: "Console.ReadLine() reads the next line of characters from the standard input stream." That means it waits until you enter whatever you like, and terminate it by hitting enter.
It you want your program to react on a single key being hit, you might consider using Console.ReadKey().
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Then how would I implement it so if b was pressed the ß comes out?
would i represent the string what with Console.ReadKey();? Or would I completely rework the code?
|
|
|
|
|
aaffbbww wrote: Then how would I implement it... ?
Start by reading the documentation on the classes/methods you are considering. Get used to help yourself, locate MSDN and/or use Google and learn how to search things. By now you have typed ten times more characters in this thread than it takes to code what you want.
aaffbbww wrote: would I completely rework the code?
Yes you may have to rework several of all 6 lines of code you have shown.
FWIW: it probably would be a good investment to spend some money and time in buying and studying an introductory book on C#.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
If you're confused I suggest you run in debug, with a breakpoint at the 'if'.
When it reaches that point (see below comments for some reasons why it may not) you can check and see what the value of 'what1' is. If it is not "b" then that explains why it is not working and you can figure out what to do from there.
If you're asking a more general question (like is this the best way to achieve what I'm trying to achieve) then you need to let us know what you're trying to achieve. It's unlikely (in my experience) that your entire logic is simply to replace every lower case b with a Beta character.
If, for example, you want to also replace any 'T' with a 7, E with a 3 (or whatever) then having a whole bunch of Ifs is probably not the best way to go about it.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
This will give you a starting point. But handling key-by-key input isn't totally straightforward to do properly. Users will expect normal console functionality to work, including arrow keys, backspace, selecting some text using the mouse and then typing or hitting backspace, cutting and pasting and so on.
This uses ReadKey and intercepts the console, meaning the character is not written. However, other side effects such as changing the cursor position still apply, so if the user presses backspace for example the cursor moves but the character is not removed.
I can't be bothered to try and work out all the specifics for you, but maybe you'd be better off not intercepting and instead writing a backspace and then the double-S char after a 'b' has been input.
class Program
{
static void Main(string[] args)
{
Console.WriteLine(
"This strange program won't let you type the letter 'b', systematically replacing it with 'ß' instead, "
+ "even though German has the letter 'b' also. Type away, and type 'exit' to quit. Do it now; this "
+ "really is pretty useless.\r\n\r\n");
string s;
while ((s = prompt("Input>")).ToLower() != "exit")
{
Console.WriteLine("Fantastic, you wrote: {0}\r\n", s);
Console.WriteLine();
}
}
static string prompt(string lead, params object[] args)
{
if (args.Length > 0)
lead = string.Format(lead, args);
Console.Write(lead);
var input = new StringBuilder();
while (true)
{
var key = Console.ReadKey();
char c = key.KeyChar.ToString().ToLower()[0];
if (c == '\r')
break;
switch (c)
{
case 'b':
c = 'ß';
break;
default:
c = key.KeyChar;
break;
}
input.Append(c);
Console.Write(c);
}
Console.WriteLine();
return input.ToString();
}
}
|
|
|
|
|
Hello.
Is it possible to create a "Peer to peer" program, where you can login with username and password, and then see users who are online and transfer files to them?
Also the offers, get a box up, they need to validate, and then he get the file..
Any tutorials, or examples/start help.
Ty
-regards
Ahlmo
|
|
|
|
|
hi you should search about socket programing
at first you need to create a server program using sockets that can qeue clients for connection and after that create client programs that connect to server with ip and tcp protocol
and for start use msdn socket programing
|
|
|
|
|
Yea. Can you show me some links plz ?
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:00am.
|
|
|
|
|
not it isn't, but i would like to know some good places
|
|
|
|
|
type this in google:
c# file transfer using socket
there are so many samplee and tutorials
|
|
|
|
|
Many of which are bad.
However, Google's ranking is probably no worse than the equally random replies one obtains here or on other forums. After all, how can the OP know if a link someone posts here is to a particularly good article, especially if the user just did a quick search and posted some result(s) from there without further ado?
|
|
|
|
|
i have a registry keys for mobile operators in Bahrain..
-- CURRENT_USER
------- Software
----------- MySoftware
------------------ Mobile Operator
and below that:
---------------------------- Batelco
---------------------------- Zain
---------------------------- STC
for every operator I have list of strings represents the mobile number range
for example f, for Batelco:
String : 39
Value : 39
String : 38
Value : 38
for Zain:
String : 36
Value : 36
String : 37
Value : 37
For STC:
String : 33
Value : 33
I want to read all in my C# program and validate a txtMobile textbox so that it has to start with one of the numbers there (it might be 2 left digits or 3 left digits or may be more or less)
|
|
|
|
|
OK, so what are asking? Are you asking how to do it? Are you asking for someone to do it? Are you having issues with doing it?
Also, please read this[^] and look at item #3. "Can anyone help plz" is not a very descriptive subject.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Search for "how to read registry" or look at the RegistryKey class in the MSDN doc[^].
|
|
|
|
|
Three days later...why are you responding to my post instead of the OP?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Maybe I was careless and should have responded to his. I am terribly sorry for the inconvenience.
|
|
|
|
|
Hi all,
I have a datagrid with 4 columns, 1st column is a combobox named "clmOptionNames" where i need to load the values from an combobox named "toolStripComboBox1" who is located outside the datagridview, the rest of the datagrid have values from a webservice and is loaded through the datasource.
Is there anyone who know how to get the content from one combobox and then insert it into a datagridview combobox? the combobox is located at column 0 in the datagridview.
|
|
|
|
|
ah forgot to drop in my code....
frm_Rights frmRights = new frm_Rights();
if (toolStripComboBox1.Text.ToString().Length != 0)
{
frmRights.label1.Text = toolStripComboBox1.Text.ToString();
frmRights.dataGridView1.Columns[1].HeaderText = "User Name";
frmRights.dataGridView1.Rows.Add("", "user1", "16-08-1971", "16:00:00");
frmRights.dataGridView1.Rows.Add("", "user2", "24-08-1983", "12:00:00");
BindingSource bindCombo = new BindingSource();
bindCombo.DataSource = toolStripComboBox1.Items;
DataGridViewComboBoxColumn datagridCombo = new DataGridViewComboBoxColumn();
datagridCombo.HeaderText = "Hello";
datagridCombo.DataSource = bindCombo;
frmRights.dataGridView1.Columns.Add(datagridCombo);
frmRights.ShowDialog(this);
}
The above code works well fine enough - only with the exception that it dont load the content into column 0 but just add a new column onto the datagridview.
|
|
|
|
|
codeproject-template.zip is empty, there is a thread with three posts saying this but no answer in a month, so I just wondered if anyone had a copy and could publish a link to it.
Thankyou
I had to sign up, I felt a bit guilty borrowing code ideas and not giving anything back.
|
|
|
|