|
Open txt2 in a streamreader object and open txt1 in a streamwriter object (setting the append argument to 'true')
txt1.Write(txt2.ReadToEnd());
txt1.Close();
txt2.Close();
txt1.Dispose();
txt2.Dispose();
- - - --[ i love it when a plan comes together ]-- - - -
|
|
|
|
|
Thank you Mr. Eduard Keilholz
|
|
|
|
|
Hi,
I m working on an interesting subject wherin i need to implement the concept of Pull Printing or Driverless printing on a client server architecture.
Can anyone assist me with the way it is implemented in C#.Or do i need to use any other .Net technology.
|
|
|
|
|
Hey guys,
Im using Crystal Reports in my C# application for the first time. Im facing a small problem though. I created a Crystal Reports document and Dataset. Then I placed all the fields from Dataset into my Report. I populate the dataset using code and when I view the report I can see all the records but apart from mapping fields to a dataset there a few fields that I would like to populate from code directly. These fields have nothing to do with my Database, its just some information that i want to place in my Crystal Report. How do I do this? I couldn't find any resources specific to my question so I've come here for help.
|
|
|
|
|
First of all you need to design a Report and then you will assign
the data set to the report ..
Importing thing all the report field name same as in the DataSet..
<
CrystalReportViewer1.ReportSource = CrystalReportSource1
Dim ds As DataSet
Dim objCMTransaction As New ForMerchantCard2Merchant
ds = objCMTransaction.CardToMerchant(Session("fromDate").ToString, Session("toDate").ToString, Session("UserName"))
' Report Parameters
Dim param1Fileds As New CrystalDecisions.Shared.ParameterFields
Dim param1Field As New CrystalDecisions.Shared.ParameterField
Dim param2Field As New CrystalDecisions.Shared.ParameterField
Dim param1Range As New CrystalDecisions.Shared.ParameterDiscreteValue
Dim param2Range As New CrystalDecisions.Shared.ParameterDiscreteValue
param1Field.ParameterFieldName = "DateFrom"
param1Range.Value = Session("fromDate").ToString
param1Field.CurrentValues.Add(param1Range)
param1Fileds.Add(param1Field)
param2Field.ParameterFieldName = "DateTo"
param2Range.Value = Session("toDate").ToString
param2Field.CurrentValues.Add(param2Range)
param1Fileds.Add(param2Field)
Me.CrystalReportViewer1.ParameterFieldInfo = param1Fileds
Me.CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables(0))
>
Rgds,
Nadeem.
|
|
|
|
|
here is the code i'm sending to your values to crystal reports as parameters to crystal reports
call below montioned code into you application.
void para(string fldName, string valName)
{
ParameterField paramfield1 = new ParameterField();
ParameterDiscreteValue disval1 = new ParameterDiscreteValue();
ParameterValues val1 = new ParameterValues();
paramfield1.ParameterFieldName = fldName;
disval1.Value = valName;
val1.Add(disval1);
paramfield1.CurrentValues = val1;
CrystalReportViewer1.ParameterFieldInfo.Add(paramfield1);
}
Happy coading.........
B.Sriniva
Ramco Systems Ltd
Chennai
9940145626
|
|
|
|
|
Hi ...
I am using one asp.net 2 Gridview control. I am binding it with a datatable. Now I want to hide two columns in the Gridview. How to do that ..Plz help me
This is my code...
DataTable dt = new DataTable("STEPS");
DataColumn dcOrder = new DataColumn("Order", typeof(Int32));
DataColumn dcName = new DataColumn("Name", typeof(string));
//Datacolumns are added to table dtsteps.
dt.Columns.AddRange(new DataColumn[] {dcOrder, dcName);
.....
//Assigning dtsteps as the datasource of my gridview dgsteps
MyGridView.DataSource = dt;
MyGridView.DataBind();
Thanks in advance....
Ranjith
|
|
|
|
|
just do the following:
datagrdview.Columns[0].Width = 0;
this will hide the 0th column of the datagridview.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
There is no property "Width" for datagridview.columns. There i found a visible property but it doesnt work
Ranjith
|
|
|
|
|
this is what u have to do after setting the data to the datagrid.
dataGridView1.Columns[0].Width = 0;
This should be enough
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
But I couldnt find any property Width for "dataGridView1.Columns[0]"
Ranjith
|
|
|
|
|
This is the better method.
dt.Columns["{COLUMN_NAME}"].ColumnMapping = MappingType.Hidden;
SINCERELY.
ANTHONY ACUÑA
PREFERED PHRASE:
SOMEBODY TELL ME WHY IS MORE REAL WHEN I DREAM THAT I AM WAKE?
|
|
|
|
|
I tried this way also.. But it is not working
Ranjith
|
|
|
|
|
There are some set of server controls its property enabled= may be true or false,now in code behind how to find its current state and i am getting the controls id during runtime like this
foreach(Control c in form1.Controls)
{
............
}
and also there is no property like (c.Enabled) to check
Thanks In Advance
|
|
|
|
|
vamsimohan21 wrote: foreach(Control c in form1.Controls)
{
............
}
A web form has a Controls collection, the trick is that it's a tree, so you need to recurse over it.
Christian Graus - C++ MVP
|
|
|
|
|
Thank sir for that and i tried with that but not got any solution can u just pls tell me any sample code and also how to know whether the control is enabled or in disabled state during runtime
Thanks In Advance
|
|
|
|
|
Web controls do in fact have an Enabled property. I just checked. Maybe you need to post your code ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
protected void Button1_Click1(object sender, EventArgs e)
{
foreach(Control c in mainform.Controls)
{
if (String.Compare(c.GetType().ToString(), "System.Web.UI.LiteralControl") == 1)
{
(//HERE I HAVE TO CHECK WHETHER THE CURRENT CONTROL IS IN ENABLED/DISABLED STATE)
if (c.Enabled)
//Error 4 'System.Web.UI.Control' does not contain a definition for 'Enabled' C:\Documents and Settings\vamsi\My Documents\Visual Studio 2005\WebSites\WebSite1\Default.aspx.cs 86 23 C:\...\WebSite1\
{
.................
}
}
}
The above is the error i am reciving sir
THANKS IN ADVANCE
|
|
|
|
|
vamsimohan21 wrote:
if (String.Compare(c.GetType().ToString(), "System.Web.UI.LiteralControl") == 1)
What on earth is this ? It's a mess.
if (c is LiteralControl)
{
// etc
}
vamsimohan21 wrote: //Error 4 'System.Web.UI.Control' does not contain a definition for 'Enabled'
Perhaps you need to have a derived class to have that property ?
LiteralControl lc = c as LiteralControl;
if (lc != null & lc.Enabled)
{
// Whatever
}
This still won't work, unless you just didn't bother to post the code that causes it to be recursive, but I don't see how it can be.
Christian Graus - C++ MVP
|
|
|
|
|
Hi
I began writing a c# program and everything was going ok until i tried to use asynchronous webrequests instead of synchronous ones (since the UI would be unresponsive while it was fetching the response) and i have a slight problem:
the user signs in by clicking a button on the form - the program fetches the data from the server asynchronously - the problem is with the callback function - when debugging i see that the request was successfully completed but when i try to access any controls (like filling a textbox with the response) from the callback function it just stop executing the function - no exceptions, no errors - i can still interact with the program but it just wont alter anything to do with the form's controls (the form's data members however were being altered with no issues - a string and an integer to be exact)
I'm a newbie at c# and i just started using the asynchronous method so if im doing sumthing wrong please advise
thank you for your time
|
|
|
|
|
A good first step would be to post some code, so we can offer some advice on it.
Christian Graus - C++ MVP
|
|
|
|
|
Hi
thanks for your quick reply
these are methods of my MainForm class (base class is Form)
<br />
private void getResult(String url, AsyncCallback callback)<br />
{<br />
try<br />
{<br />
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);<br />
request.Method = "GET";<br />
if(useCompression)<br />
request.Headers.Add("Accept-Encoding: gzip,deflate");<br />
request.CookieContainer = mainCookie;<br />
request.AllowAutoRedirect = true;<br />
request.AllowWriteStreamBuffering = true;<br />
<br />
IAsyncResult result = request.BeginGetResponse(callback, request);<br />
}<br />
catch (WebException wex)<br />
{<br />
MessageBox.Show("Error Connecting: Check your connection settings...\nDetails: " + wex.Status.ToString());<br />
return;<br />
}<br />
}
<br />
private void SignInButton_Click(object sender, EventArgs e)<br />
{<br />
DisableSignInControls();<br />
String url = mirror + "signin.aspx?user=" + UserNameComboBox.Text + "&pass=" + PasswordTextBox.Text;<br />
mainCookie = new CookieContainer();<br />
getResult(url, new AsyncCallback(signIn));<br />
}<br />
<br />
<br />
private void signIn(IAsyncResult result)<br />
{<br />
HttpWebRequest request = (HttpWebRequest)result.AsyncState;<br />
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);<br />
String responseResult = (useCompression ? decompressResponse(response) : new StreamReader(response.GetResponseStream()).ReadToEnd());<br />
int i = responseResult.IndexOf("<response>");<br />
if (i < 0)<br />
MessageBox.Show("Corrupt response. Please try again.");<br />
else<br />
{<br />
int j = responseResult.IndexOf("</response>");<br />
String temp = responseResult.Substring(i + 10, j - i - 10);<br />
if (temp != "")<br />
{<br />
String[] returnValues = temp.Split('|');<br />
if (returnValues.Length == 1)<br />
MessageBox.Show(returnValues[0]);<br />
else<br />
{<br />
sid = returnValues[0];<br />
num_messages = int.Parse(returnValues[1]);<br />
MessageNumber.Text = "Messages: Left " + num_messages;<br />
SignInGroupBox.Visible = false;<br />
SendSMSGroupBox.Visible = true;<br />
SignOutMenu.Visible = true;<br />
FillContacts();<br />
}<br />
}<br />
}<br />
EnableSignInControls();<br />
FillUsers();<br />
}<br />
the other functions are also part of the mainform class and they all make changes to the controls on the form.
do you need more info?
thanks again.
|
|
|
|
|
wajih.boukaram wrote: IAsyncResult result = request.BeginGetResponse(callback, request);
Doesn't result just get discarded ? And where is the callback hooked up to a method ?
Christian Graus - C++ MVP
|
|
|
|
|
yea it does but all that matters is the callback function (which i assigned when i called getResult(url, new AsyncCallback(signIn));
so its hooked up to signIn
it works fine the way it is - only problem is changing the form's control values - i think it might have something to do with threading because if i try calling the function a second time (I hate c# sometimes) it says sumthin about accessing an object that was not created on the same thread - when i first tried to do this asynchronously i actually just created a new thread that called my initial signIn function which was just a regular function and not a callback - i got the same error message when acessing the controls.
any suggestions?
thanks for your replies.
|
|
|
|
|
I was just wondering if anyone has managed to create a C# object that is exposed as a COM object and successfully insert it into the Running Obhect Table (ROT). Just as important, once in the table have you been able to extract it and actually call a method on it.
To test this, I have created two projects. The first one creates the C# object and inserts in into the ROT. It then waits until cancelled. The second one attempts to retrieve the object from the ROT. The second project contains a reference to the dll that contains the C# object created in the first project.
I believe I can successfully insert the object into the Running Object Table. As I can see the object in the ROT if I dump the contents.
When I try to access the entry, I seem to be able to pull it out of the table. But when I try to bind to the object
<br />
iMoniker.BindToObject(ctx, iMoniker, ref IID_ICancelAutoplay, out o);<br />
I get a "System.IO.FileNotFoundException" indicating "The specified module could not be found (Exception from HRESULT:0x8007007e)".
Any thoughts, hints would be greatly apreciated. I'd even be willing to be spoon feed on this one.
Thanks
Tim
|
|
|
|