|
If you had followed my earlier suggestion and looked at the properties in the documentation, you would have spotted MultiSelect[^].
|
|
|
|
|
I did follow your suggestion. That doesn't mean it gives a working code example that I can insert into my form and start to figure out its intricacies.
I can't even get the event handlers to work with this object, it tells me the following error for the following code?
Error 4 Cannot implicitly convert type 'System.Windows.Forms.DataGridViewCellEventHandler' to 'System.EventHandler' c:\Form1.cs 51 47
this.dataGridView1.CellClick += new DataGridViewCellEventHandler(dataGridView1_CellClick); // works
this.dataGridView1.DoubleClick += new DataGridViewCellEventHandler(dataGridView1_CellDoubleClick); // generates the above error
|
|
|
|
|
DataGridView does not have a DoubleClick event, it is inherited from Control. You should be using CellDoubleClick or use the approprite casting for double clicking of the entire form.
|
|
|
|
|
Thank you, celldoubleclick worked.
With multiselect, that appears to just be a property that you enable or disable. If enabled, how can I know which cells I've selected? Then I could input the data for the select cells with a right click command possibly?
|
|
|
|
|
turbosupramk3 wrote: how can I know which cells I've selected? Once again, go and look at the documentation, see what information you get presented with by the different events.
|
|
|
|
|
Hello guys!
How to save text from multiline TextBox2 as (.txt) UTF-16 (Unicode), and not as UTF-8.
This is my code that is not good:
saveFileDialog1.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
saveFileDialog1.FileName = String.Empty;
saveFileDialog1.DefaultExt = ".txt";
DialogResult result = saveFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
byte[] contents;
System.Text.Encoding ascii = Encoding.Unicode;
contents = ascii.GetBytes(textBox2.Text);
using (Stream fs = (Stream)saveFileDialog1.OpenFile())
{
fs.Write(contents, 0, contents.Length);
fs.Close();
MessageBox.Show("File successfully saved!");
}
}
I need a better solution. Thank you!
modified 22-Dec-14 4:22am.
|
|
|
|
|
Member 10410972 wrote: I need a better solution. Better in what way? You need to explain what problem you are trying to solve.
|
|
|
|
|
Thank you.
I really need the code for savefiledialog1 with encoding as:
SaveFileDialog saveFileDialog = new SaveFileDialog();<br />
saveFileDialog.InitialDirectory = "@:\\";<br />
saveFileDialog.Filter =<br />
"ANSI encoding (*.*)|*.*|"<br />
+ "Unicode (UTF-8) encoding (*.*)|*.*|"<br />
+ "Unicode encoding (*.*)|*.*|"<br />
+ "All files (*.*)|*.*";
(My textBob is textBox2.Text)
Please look at the picture:
http://www.dodaj.rs/f/i/9b/orO7WE9/1.png
Please help me! Thank you.
|
|
|
|
|
SaveFileDialog has nothing to do with it, it is just a dialog that gets a filename from the user. You save data to a file by using something like the StreamWriter class[^]. You should read the documentation to find out which options to use for what you want to achieve.
|
|
|
|
|
Doesn't look too bad to me, except for the part about calling your Unicode encoding 'ascii'.
How about using StreamWriter? The constructor takes an encoding and has methods to write strings so you can do away with the byte array stuff.
Regards,
Rob Philpott.
|
|
|
|
|
Hello guys!
This is my code:
private void openToolStripMenuItem_Click(object sender, EventArgs e)<br />
{<br />
OpenFileDialog openFileDialog1 = new OpenFileDialog();<br />
openFileDialog1.Title = "";<br />
openFileDialog1.InitialDirectory = "c:\\";<br />
openFileDialog1.FileName = null;<br />
openFileDialog1.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";<br />
openFileDialog1.FilterIndex = 1;<br />
openFileDialog1.RestoreDirectory = true;<br />
DialogResult result1 = openFileDialog1.ShowDialog();<br />
string file1 = openFileDialog1.FileName;<br />
if (result1 == DialogResult.OK)<br />
{<br />
Encoding enc = Encoding.GetEncoding("Windows-1251 && Windows-1250");<br />
string s = File.ReadAllText(file1, enc);<br />
textBox1.Text = s;<br />
}<br />
<br />
}
The problem with this code:
Encoding enc = Encoding.GetEncoding("Windows-1251 && Windows-1250");
Please see the image:
http://www.dodaj.rs/f/3Z/O6/1uQ1dcT1/33.png
I need the Windows-1250 and Windows-1251. What is the solution? Thank you!
|
|
|
|
|
|
Okay I understand. Thank you!
|
|
|
|
|
use like this ...
// Get a UTF-32 encoding by name.
Encoding e2 = Encoding.GetEncoding( "utf-32" );
|
|
|
|
|
Hi,
I have SMS gateway and they only allow SMPP protocol to be used to send SMSs.
Is it possible to send use SMPP using just C# .NET Framework or I should use a third party?
if not possible, any free third-party?
Thanks,
Jassim
Technology News @ www.JassimRahma.com
|
|
|
|
|
|
You asked the very same question on t 1st of November - what about the answers there?
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
hi,
im developing a list page which has more than 20 columns.i know its bit long.so i want to make it more flexible,the idea is..i want the user to select which columns they need to see in the list.n based on their selection data must be bring back from the back end(only
the selected columns).we have a very huge database so.i want to make very optimized request..please suggest a best way to implement this
|
|
|
|
|
So what is your problem here.
Step 1:
Place a link or button on top of List.
When user click open a popup window load column name from sql to gridview wich check box column.
here is query to load all column name from a table.
SELECT Column_name
FROM information_schema.columns
WHERE table_name = 'YourTable_Name'
ORDER BY ordinal_position
From popwindow get all the selected column name and display the selected column in your main form.
Step 2:
By default load all columns and make visible selected columns .
Place a link or button on top of List.
When user click open a popup window load column name from sql to gridview wich check box column.
here is query to load all column name from a table.
<pre lang="SQL">
SELECT Column_name
FROM information_schema.columns
WHERE table_name = 'YourTable_Name'
ORDER BY ordinal_position
</pre>
From popwindow get all the selected column name and make visible tru and false for the selected columns.
|
|
|
|
|
Please post your question in only one forum at a time.
«OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. » Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."
|
|
|
|
|
Select required fields and append in a string variable spreading by coma(,) then it's pass Select Query Command .
|
|
|
|
|
Hey,
i was working on some API for networking when i implemented some sort of logging and Reporting, in certain situations when all of the sudden my Test project in WPF didn't worked as expected. After some debugging i found a Cross-Thread exception that was caused by some bindings. The API is using some High Level of threading and Tasking support.
The problem was that i was attached to a Event that was trigger in a Non-Dispatcher Thread, and inside my ViewModel i did not synchronized the code. The Whole application was still running ( AppDomain had some global exception Handling ) but the point is, this external exception ( as seen from the API side ) had noting to do with the API but prevented it from working by throwing an Exception and stops the execution of the code after the Event Trigger.
I learned due my time as a Developer that some sort of "General" exception catching should be prevented where possible. This does not mean an empty TryCatch block ( What is actually even very Bad ).
So my Question is:
Should i break this Design guide and more, should i catch Exceptions in general when i Invoke an event? The event handler could Throw some exceptions what i do not expect and i should not worry about. And last but not least: If jes, what to do when we catch an event?
|
|
|
|
|
Jean-Pierre Bachmann wrote: should i catch Exceptions in general when i Invoke an event? Nah. If you did and an exception occurs, how would I even know?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
My problem is about how to call a c# function like this
string Block = "1111111111";
string a = "87654321";
string m = "2222";
string c = "11";
string u = "99";
string v = "00";
byte[] result = W(
SoapHexBinary.Parse(a).Value,
SoapHexBinary.Parse(m).Value,
SoapHexBinary.Parse(v).Value[0],
SoapHexBinary.Parse(u).Value[0],
SoapHexBinary.Parse(c).Value[0],
SoapHexBinary.Parse(Block).Value
);
from VB.NET
Dim Block As String = "AAAAAAAAAA"
Dim a As String = "99999999"
Dim m As String = "3333"
Dim a As String = "77"
Dim u As String = "07"
Dim v As String = "00"
Dim result As String = ""
result = W(a, m, v, u, a, Block)
a, m and Block are not accepted.
I'm not a C# expert so I guess that there is something to be done in order to correctly address strings and arrays between the two languages. Must be kind of basic rule I ignore...
Anybody can help?
Thanks in advance.
Seppax
|
|
|
|
|