|
Hello,
Any help would be great! I have tryed the (datagrid.columns[1]. visable = false) the issue is that, using this method shrinks all the rows of data in the data grid view. Even if i set the row height, it seems to make no difference. I need to set which columns are shown in code, and I change the data source for the data grid view as needed. I have also tryed (datagrid.columns[i].width = 0) and (col.width = 0), both produce the same result, the column width is changed to 0, but you can still see the column, only it appears as a line, and if you are hiding a few columns then it is very noticable. Also you can streach the columns with a width of 0 back out again.
any help would be great.
Thanks to thoes who replyed to my first question for this, I did try all suggestions.
thanks, J
|
|
|
|
|
jasper018 wrote: I have tryed the (datagrid.columns[1]. visable = false) the issue is that, using this method shrinks all the rows of data
Where have you tried this and what do you mean it shrinks the rows?
jasper018 wrote: Thanks to thoes who replyed to my first question for this, I did try all suggestions.
So this is a repost of the same question?
only two letters away from being an asset
|
|
|
|
|
answer question 1: when using the (datagrid.columns[i].visible = false) method when the data grid load in the form, the row height is set to 0, even if i reset is before it is displayed it does not change. so there for all the rows appear shrinked. I do not know why this is happening, and no matter what I do, or set, it seems to set the row height to 0.
answer question 2: Yes I have posted this question before... the responses I had gotten, though helpfull, did not help with my problem, i am really stumped with this one.
|
|
|
|
|
try to use AutoSizeMode=Fill for any visibale columan,, hope it will work
|
|
|
|
|
Thanks i am going to give that a try!
|
|
|
|
|
Thanks for the reply! )
That did not seem to work either
|
|
|
|
|
Hi,
I am reposting this message,plz help me to fix it.
I have written code for sending mails using c#.I am facing the following problem with this.
Mail Body is not showing up for Meeting requests/mail received through Lotus Notes. The meeting request is shown correctly when viewed through the Outlook with the body showing up but not in Lotus Notes.
Here is the code i am using,
msg.From = new MailAddress(From);
msg.Subject = Subject;
msg.SubjectEncoding = System.Text.Encoding.Default;
StringBuilder strBodyText = new StringBuilder();
strBodyText.AppendLine(some string on logical criteria);
msg.Body = strBodyText.ToString();
msg.BodyEncoding = System.Text.Encoding.Default;
msg.IsBodyHtml = false;
msg.Priority = MailPriority.High;
SmtpClient client = new SmtpClient();
client.Port = 25;//or use 587
client.Host = smtpServer;
client.Send(msg);
Plz help me...
Thanks in Advance
Alok...
|
|
|
|
|
|
Hey Thanks for replying.......
Really helpfull! I was not excepting that I got the answer only in few minutes..
|
|
|
|
|
You can repost this as many times as you like, but the answers (which you've already been given) does not change.
|
|
|
|
|
alok_2k3 wrote: I am reposting this message,
Don't do that. It is rude. If someone has an answer for you, they will eventually reply. Reposting the same message over and over doesn't accomplish anything but irritated people...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I don't agree with you. The other day, a person reposted a question to which he did not get an answer, in the hope that he would get one this time.
I happened to see his question that time and was able to answer it. At least, they stay polite by mentioning the repost fact.
|
|
|
|
|
Le Centriste wrote: a person reposted a question to which he did not get an answer, in the hope that he would get one this time
That doesn't do much good except flood the forums with redundant posts.
The very reason Chris put View unanswered questions in the C# forum in each forum, so posts that haven't received any replies don't get lost.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hello,
I hope somebody has a good explanation for this issue.
Okay I'm having troubles with the httpWebRequest method. I need to download reports from a specified server (can't give these details). Now I don't have trouble with an "HTTPS" url but I with an "HTTP" url I get the error :
error: The server committed a protocol violation. Section=ResponseHeader Detail=Header name is invalid
This the first time I got this error in c#.net. I tried this in Java and there I didn't had any problems. So I'm kind of lost.
I search the internet to see what the "ProtocolViolationException" throws. I found this on the msdn site:
ProtocolViolationException :
Method is GET or HEAD, and either ContentLength is greater or equal to zero or SendChunked is true.
-or-
KeepAlive is true, AllowWriteStreamBuffering is false, ContentLength is -1, SendChunked is false, and Method is POST or PUT.
I did an output of these properties and some how these don't have the values mention to trigger the ProtocolViolationException.
So my question is, How is this possible?
this is my testClass:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Net;
namespace adlogix_views
{
static class httpTestClass
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
string page = "";
try
{
// write a line of text to the file
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create("http://www.mywebsite.com");
string userPass = "myUsername:myPassword";
string encoding = Convert.ToBase64String(Encoding.ASCII.GetBytes(userPass));
wr.Headers.Add("Authorization", "Basic " + encoding);
wr.PreAuthenticate = true;
Console.WriteLine("Method = " + wr.Method);
Console.WriteLine("ContentLength = " + wr.ContentLength);
Console.WriteLine("SendChunked = " + wr.SendChunked);
Console.WriteLine("KeepAlive = " + wr.KeepAlive);
Console.WriteLine("AllowWriteStreamBuffering = " + wr.AllowWriteStreamBuffering);
HttpWebResponse ws = (HttpWebResponse)wr.GetResponse();
Stream str = ws.GetResponseStream();
StreamReader sr = new StreamReader(str);
while ((page = sr.ReadLine()) != null)
{
Console.WriteLine(page);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
this is the output of the properties
output: Method = GET
ContentLength = -1
SendChunked = False
KeepAlive = True
AllowWriteStreamBuffering = True
I hope somebody can help me with this.
|
|
|
|
|
Hi
I am passing data between SQL 2005 and a CLR stored procedure developed in C# via the Service Broker, which uses XML as its transport. It's posted here as the problem is more C# than SQL. The message is read in the C# stored procedure using an SQLDataReader.
The value, a string, is retrieved from the reader as an array of bytes.
byte[] mystring = (byte[])myReader[2];
mystring is populated with the ascii values of each character in my string, but interspersed with nulls ( 0s ), the equivalent of
byte[] mybytes = {53,0,49,0,50,0,57,0}; I can't seem to encode this back to a string. I've tried straight ASCIIEncoding, going via UTF8 (google?) with the following :-
byte[] temp = { 53, 0, 49, 0, 50, 0 , 57 , 0};
byte[] buf = Encoding.Convert(Encoding.GetEncoding("iso-8859-1"), Encoding.UTF8, temp);
string attempt1 = Encoding.UTF8.GetString(buf, 0, 8);
string attempt2 = System.Text.ASCIIEncoding.ASCII.GetString(temp);
What am I missing? To cut a long story short I want to convert byte[] temp = { 53, 0, 49, 0, 50, 0 , 57 , 0}; to a string like "5129" .
I am currently hacking it with a Replace("\0" , "") which is really professional!
Regards
Knowledge is hereditary, it will find its way up or down. - Luc Pattyn
so you answer don't be scared of failure
The only failure is never to try
Things You've Never Done - Passenger -2008
|
|
|
|
|
Don't know if I get the problem exactly, but this seems to work:
byte[] data = { 53, 0, 49, 0, 50, 0, 57, 0 };
byte[] filter_data = Array.FindAll(data, new Predicate<byte>(delegate(byte b) { return b != 0; }));
string s = Encoding.ASCII.GetString(filter_data);
Standards are great! Everybody should have one!
|
|
|
|
|
Thanks - it's similar to my Replace - get rid of the nulls and it works.
I suppose I am asking if a byte[] encoded string should contain two bytes for each character?
And I suppose I should actually go and try that myself!!
Knowledge is hereditary, it will find its way up or down.
Luc Pattyn
and since what every time when i want to add button to this control one add two times
posted in C# forum
|
|
|
|
|
Ah ok. In that case, unicode? This gets the right result...
byte[] data = { 53, 0, 49, 0, 50, 0, 57, 0 };
string s = Encoding.Unicode.GetString(data);
Standards are great! Everybody should have one!
|
|
|
|
|
Bekjong wrote: Ah ok. In that case, unicode? This gets the right result...
Yes it does. How embarrasingly simply was that?
Thank you.
Knowledge is hereditary, it will find its way up or down.
Luc Pattyn
and since what every time when i want to add button to this control one add two times
posted in C# forum
|
|
|
|
|
Glad to help. Not so emarrasing, I've spent most of my day looking for an off-by-one bug.
Standards are great! Everybody should have one!
|
|
|
|
|
I have an object that does work in the background and fires events as certain things happen. If this object is destroyed will the thread be automatically terminated.
I'm guessing that if the thread is not terminated then I need to implement the IDisposable interface and set Dispose() method. I would rather not do this, but I have in the past had code that kept the debugger running because the child thread was still in operation. At the time however I was using
new Thread(new ThreadStart(myThread)).Start()
so I assumed that, while the thread was started from the object, it was not contained within the object's running environment and it was not able to be GCed with the rest of the object.
I implemented a stopping routine when the program was being terminated. However, I am unable to do the same this time.
The thread that is being created is being created as an object
private Thread myThread
so I'm thinking that the thread would be terminated upon the object being destroyed. I certainly hope this is the case.
|
|
|
|
|
No, threads will live until:
* They are finished
* They get an exception and exit
* They are aborted
* Threads with .IsBackground = true will exit when the current process ends
(btw. did I miss something?)
But if you create a thread inside an object, it will not stop just because your object dies.
|
|
|
|
|
A recommended way is to use ThreadPool.QueueUserWorkItem to obtain worker threads for your application rather than creating threads directly. Otherwise you should set Thread.IsBackground = true; This will prevent the app from being held open by any threads that are still running.
only two letters away from being an asset
|
|
|
|
|
There's a property called IsBackground on your thread, if this is set to true the thread will be terminated when your program exits. If you want to stop the thread at runtime you'll have to do this from code: The garbage collection won't clean the object it's running from until the thread's stopped (the thread still holds a reference to its parent container), this doesn't necessarily have to be from an IDisposable implementation though: If you stop the thread and there's no references to its parent object anymore the object will be taken care of by the gc.
Standards are great! Everybody should have one!
|
|
|
|
|
The best solution for this is to use a flag in each thread that when set to true allows the thread to run. When this same flag is set to false, the thread exits. Then in the dispose method, set the flag to false and the threads will exit. This is called a co-operative exit which allows the thread to complete its current task before exiting.
Using thread pool threads to complete your work may seem like a good idea, but one must remember that thread pool threads are not executed if the system is busy. In otherwords, if the work being done in a thread is critical, it should not be put in a thread pool thread.
Using thread.abort() to terminate the thread means that if the thread will be interrupted during its execution and told to terminate. If the task being performed by the thread is critical and must be completed, using thread.abort() will at some point interrupt that task and cause problems.
Phil
|
|
|
|
|