|
XML Format is just a normal string. Convert it to byte[], then send it.
byte[] data = Encoding.ASCII.GetBytes("<root>abc");
tcpClient.Write(data, 0, data.Length);
|
|
|
|
|
I am trying to open MS word file or PDF fie in my project tel me what should i do for this.
I have searched on net but still i am facing problem in this code which is,
if (this.openFileDialog1.ShowDialog() == DialogResult.Yes)
{
// set the file name from the open file dialog
object fileName = openFileDialog1.FileName;
object readOnly = false;
object isVisible = true;
// Here is the way to handle parameters you don't care about in .NET
object missing = System.Reflection.Missing.Value;
// Make word visible, so you can see what's happening
WordApp.Visible = true;
// Open the document that was chosen by the dialog
Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible);
// Activate the document so it shows up in front
aDoc.Activate();
// Add the copyright text and a line break
WordApp.Selection.TypeText("wFile.doc");
WordApp.Selection.TypeParagraph();
}
In Bold code their is error this is not working.
WHAT SHOULD I DO ?
|
|
|
|
|
Sajjad Leo wrote: WHAT SHOULD I DO ?
State the error that you are getting and use the <pre> tag around code when you're posting
I are troll
|
|
|
|
|
This is the error
no overload for method 'open' takes '12' arguments
|
|
|
|
|
Sajjad Leo wrote: no overload for method 'open' takes '12' arguments
then thats your problem. Do you not understand that simple message?
if your IDE doesnt help with params then search for the function signature on google. you should find that the Open function wants 15 params, 3 more (15 - 12) than you are giving it
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
ok i am trying to find more three but do you any idea then tell me
well thanx ....
|
|
|
|
|
your problem is that you are passing too many parameters in the open method. Use intellisense to find out what parameters the method accepts.
|
|
|
|
|
Hi All,,
I Want To Get The Date Of All Friday Days In the Year
How Can I Do That,,,,
void GetAllFridayDate(2009)
{
return allFridayDate
}
|
|
|
|
|
Hi,
initialize a DateTime with the first of January. Then check if this is a Friday, if not add one day with AddDays(1) and check if this is a Friday. Do this until you get the first Friday within the year. Then add 7 days as long as the date is within the year. This will give you all Fridays of the passed year.
Regards
Sebastian
|
|
|
|
|
please can you help Me by a code
|
|
|
|
|
Hes told you what you need to do, its up to you to code it! If you don't know how to check what day of the week it is, try hitting F1 from within the ide when you have hightlighted DateTime
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Come on, don't be a noob here.
He gave you all, and really ALL the steps you need to get all the friday's of a year.
But you probably don't even know the basics, so I'd say: do a beginners tutorial. Specially for you I've typed it in google and got the first link for you: here[^]
|
|
|
|
|
Not code, but if you cannot work this into code then i suggest you forget what your trying to do and start learning programming from the beginning...
create collection of DateTimes.
create DateTime as first of january for the desired year(from you param).
Start while loop.
if the year value of your DateTime is not the year value of your param then break the loop.
check if day if friday, if it is then store date in collection, then add 7 days to the DateTime.
else add oneDay.
end the loop.
return the collection.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Yes, here you are the code: #124fg@@!w .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi guys,
I´m gonna create a new project but I don´t now what technology I can use, because it´s a project that´s gonna have a dynamic menu, I´m gonna use PostGree DataBase, and I´m want to use ASP.Net C# ou VB...
Someone has some opinion about the architecture? For example: I´m thinking to use MVC framework... but I don´t know if it´s a better way..
Thanks a lot
|
|
|
|
|
Didn't work with the MVC yet, but it looks nice...
I think it all depends on your own favors, what you know already and if you have the time to learn something new.
Regards
Sebastian
|
|
|
|
|
There are many ways, and many patterns which you can use. But if I was in your place, I'd use the MVC model. It's simple and I guess it fits your requirements.
|
|
|
|
|
Can anyone know how to add a dropdownlist or a label inside a table that declare dynamically?
Here the code of what I understand.
Inside the HTML tag
<form id="Form1" action="TEST.aspx" runat="server"></form>
Inside the script tag using C#
void Page_Load(Object s, EventArgs e)
{
Table elbat = new Table();
TableRow record = new TableRow();
TableCell column = new TableCell();
Label ttt = new Label();
ttt.Text = "B";
column.Text = "A";
record.Controls.Add(column);
elbat.Controls.Add(record);
Form1.Controls.Add(elbat);
}
Basically, by doing
record.Controls.Add(ttt) cant be done with that
Thanks, in advance
|
|
|
|
|
hi
Does textbox have Autosize property?
one interesting subject
when i use Autosize property in win app there is but when i use in class library project there is not any property that named AutoSize
????
???
??
?
.
|
|
|
|
|
behzadcp wrote: Does textbox have Autosize property?
Nope.
behzadcp wrote: when i use Autosize property in win app there is but when i use in class library project there is not any property that named AutoSize
You might have mixed up classes. Are you using a label, or mayhaps setting the Form.AutoSize property by accident?
behzadcp wrote: ????
???
??
?
.
If you're lost, you can always check MSDN for information on the TextBox[^] component.
I are troll
|
|
|
|
|
No there isnt any inbuilt 'AutoSize' property for textbox but you can do some tricks. Here is one
write the following code in TextChanged and FontChanged events of TextBox.
Graphics g = Graphics.FromHwnd(IntPtr.Zero);
TextBox.Size = g.MeasureString(TextBox.Text, TextBox.Font).ToSize();
g.Dispose();
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
behzadcp wrote: Does textbox have Autosize property?
No.
behzadcp wrote: when i use Autosize property in win app there is but when i use in class library project there is not any property that named AutoSize
Not possible. The TextBox class is same be it win app or a class library.
Moreover, why would you need that?
With textboxes, you can always make it multiline, set WordWrap to true and set scrollbars property to Vertical.
If you need to grow/shrink the textbox with increase/decrease in the size of its container, then you should employ anchoring and docking.
जय हिंद
|
|
|
|
|
i am getting image based slideshow by using image list and picture box. i want it to make it more dynamic and flexible... I tried using "System.IO.Directory.GetFiles("C://MyPictures")"......So tat image files (after specifying the extension also ("*.jpeg"))can be extracted from the directory and be displayed as slideshow.....But its kinda not working out for me....need help !!!
**************************************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
timer1.Interval = 3000;
timer1.Enabled = true;
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
System.IO.DirectoryInfo dirInfo=new System.IO.DirectoryInfo("C://Images");
System.IO.FileInfo[] files=dirInfo.GetFiles("*.jpeg");
if(files!=null)
{
foreach(System.IO.FileInfo file in files)
{
pictureBox1.Image=Image.FromFile(file);
}
}
}
}
}
|
|
|
|
|
Hi,
Do you get a sepcific error message during comilation/runtime?
Try to use
<br />
pictureBox1.Image = Image.FromFile(file.FullName);<br />
FromFile accepts only the filename, not the FileInfo.
Regards
Sebastian
|
|
|
|
|
The most obvious thing here is that by putting all of the file fetching code inside the ontick handler, each time it fires, it gets all the files again and shows the first one every time (I think).
My suggestion, move
System.IO.DirectoryInfo dirInfo=new System.IO.DirectoryInfo("C://Images");
files=dirInfo.GetFiles("*.jpeg");
into Form_Load(), or other suitable place.
create System.IO.FileInfo[] files = null; as a field of the form.
add an index field int index = 0; as well.
Then in your ontick handler
if (files != null)
{
if (index >= files.Length)
{
timer1.Enabled = false;
}
else
{
pictureBox1.Image=Image.FromFile(files[index++]);
pictureBox1.Image=Image.FromFile(files[index++].FullName);
}
}
[MOD]
Realized I had forgotten the '.FullName' property
[/MOD]
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
modified on Thursday, March 26, 2009 4:49 PM
|
|
|
|