|
You can use the "is" keyword and cast it to the appropriate type, like so:
foreach (UserControl ctrl in tabPage1.Controls) {
if (ctrl is usxClientDetail) {
usxClientDetail clientDetail = ctrl as usxClientDetail;
}
}
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Thanks that works. I costed me 2 hours today en asking at CP 5 minutes ..
again thnx.....
Kind regards,
Marcel Vreuls
http://www.marcelvreuls.com
< >
|
|
|
|
|
Hi friends
I wrote follow code to send an image in network:
<br />
BinaryWriter myBR = new BinaryWriter(MyNetworkStream);<br />
myPic.Save(MyMemoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);<br />
byte[] arrImage;<br />
arrImage = MyMemoryStream.GetBuffer();<br />
myBR.Write(arrImage);<br />
And this for receive it:
<br />
MemoryStream memstr = new MemoryStream();<br />
byte pic;<br />
BinaryReader br = new BinaryReader(myNetworkStream);<br />
bool loop = true;<br />
while (loop)<br />
{<br />
try<br />
{<br />
pic= br.ReadByte();<br />
memstr.WriteByte(part);<br />
}<br />
finally<br />
{<br />
loop = false;<br />
}<br />
}<br />
byte[] picture = memstr.GetBuffer();<br />
but in receive part, when it arrive to "pic = br.ReadByte();", it do no thing and there is no error.
can you tell me what is incorrect code?
|
|
|
|
|
Maybe I'm not understanding your problem, but why are you using a binary reader? Just use myNetworkStream.ReadByte()
|
|
|
|
|
An array of bytes is not represented the same way as individual bytes by the BinaryWriter. You can't write the data as an array and read it as individual bytes.
Why are you using a BinaryWriter and BinaryReader at all? Why not write and read the data directly?
---
single minded; short sighted; long gone;
|
|
|
|
|
Your loop existsexits on the first loop every time. Finally is always executed after a try block. What you intended was likely catch{loop = false;} but you need a different understanding of streams, instead.
byte[] bytes = new byte[255;]
while((bytesRead = stream.ReadBytes(bytes, 0, bytes.Length)) != 0)
otherStream.Write(bytes, 0, bytesRead);
is a better construct for copying a stream to another. (255 is arbitrary)
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Dear gurus,
is it possible to download the complete net-framework-3.0-sdk from anywhere (e.g. as a zip-file)?
If I try to download it from micrsoft, than I only get a small "setup.exe". This one seems to start some downloads by itself in background during installation.
In advance:
Thanks for your advices
|
|
|
|
|
On this[^] page under Instructions you can download the redistributable packages that contains the entire framework instead of just a bootstrapper.
|
|
|
|
|
Thanks for your help!
The site you recommended contains only the redistributable package. It is not the complete SDK.
Is there also any site?
Thanks !
|
|
|
|
|
Here?[^] Click the "Continue" button next to "validation required" and a DVD image file will become available for download in the Instructions section - if your Windows validates properly. Is that what you're looking for?
|
|
|
|
|
Hallo,
yes it is what I was looking for.
With kind regards
and thank you
|
|
|
|
|
Hi,
I have some win form application - and on the Form i have some UserControl that i wrote -
On the Form i define some button to be as "AcceptButton" ( button of the Form and not the button that is on the userControl ).
Now ... when the form is up i always get one of the userControl button as the "AcceptButton" and not the button that i define.
This happen only on one of the userControl - other userControl work fine.
What to do ?
Thanks for any help.
|
|
|
|
|
hi all
In my application, i have a treeview consisting of some nodes. when i click a node, i am generating some images
and displaying them in a listview.
i am storing the images temporarily in a folder in the application path.
so everytime a node is clicked,
i need to remove the original images and add the new images.
when i tried to delete the contents of the folder, it says file is in use(which is obvious).
Can anybody suggest me ideas as how to remove the old images from the folder?
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
You must have forgotten to close the filestream or something. So all you need to do is make sure you Close() all your streams before deleting all your files.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
hi,
thanks for your reply. but i am not using filestream class at all.
i used the following code.
foreach (File file in Directory.GetFiles(path))
{
File.Delete(file);
}
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
"i am storing the images temporarily in a folder in the application path"
Does that not mean that your creating a new files, and writing to them during runtime? Because if it does, once youve written the file, you need to close the stream.
If the files are already there, then unless you've got them open somewhere, or explorer has them open. They should just delete fine.
If its the latter, go download 'unlocker' and see whats holding your files hostage.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
i think u shuld check the permission of the Folder in which u are storing ur image file.Give the permission of write also.
May be it will work for you. or i m not getting ur question
Thanks and Regards
Aavesh Agarwal
|
|
|
|
|
Im not sure, but what you can do is make sure that your byte array isn't empty. And if thats OK, once you set up your memory stream, make sure that it also, is not empty.
Now, im not savvy with sql databases and whatnot, but, could you not do something like this:
Bitmap img = (Bitmap)cmd27.ExecuteScalar();
pictureBox1.Image = img;
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Waffle, thanx for your response...i tried what u said, bud it did'nt help.
|
|
|
|
|
Hi,
I have a TcpClient connection running and always get this Exception only when running Releas version. I never get this Exception while Debugging same code. Exception always occurs on same place.
System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by
the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was
aborted by the software in your host machine
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.BinaryWriter.Write(Byte[] buffer)
It is not races... it's run on same thread as application form (at the time when error occurs).
Any suggestions ?
zilo
-- modified at 8:45 Wednesday 10th October, 2007
|
|
|
|
|
I've the same problem long time ago, I solved it by turning off firewall and antivirus program
VirtualVoid.NET
|
|
|
|
|
I've abandoned that solution and picked another one...
no way I can fix that...
zilo
|
|
|
|
|
im generating an xml file. how to add namespace to a node in that xml.
My Xml looks as below,
<?xml version="1.0" encoding="utf-8"?><br />
<StaffingOrganization xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ns.hr-xml.org/2006-02-28 StaffingOrganization.xsd HR-XMLExtension.com AccountExtension.xsd" typeOfOrganization="Customer" xmlns="http://ns.hr-xml.org/2006-02-28"><br />
<Organization><br />
<OrganizationName></OrganizationName><br />
<OrganizationId><br />
<IdValue name=""></IdValue><br />
</OrganizationId><br />
<ContactInfo><br />
<ContactMethod><br />
<Telephone><br />
<FormattedNumber></FormattedNumber><br />
</Telephone><br />
<InternetEmailAddress ></InternetEmailAddress><br />
<InternetWebAddress ></InternetWebAddress><br />
<PostalAddress><br />
<CountryCode></CountryCode><br />
<PostalCode></PostalCode><br />
<Region></Region><br />
<Municipality></Municipality><br />
<DeliveryAddress><br />
<AddressLine></AddressLine><br />
<BuildingNumber></BuildingNumber><br />
</DeliveryAddress><br />
</PostalAddress><br />
</ContactMethod><br />
</ContactInfo><br />
</Organization><br />
<ReferenceIdInfo><br />
<StaffingCustomerId><br />
<IdValue name=""></IdValue><br />
</StaffingCustomerId><br />
<StaffingCustomerOrgUnitId><br />
<IdValue name="Branch"></IdValue><br />
<IdValue name="BranchName"></IdValue><br />
</StaffingCustomerOrgUnitId><br />
</ReferenceIdInfo><br />
<UserArea><br />
<CompanyExtn xmlns="HR-XMLExtension.com"><br />
<WorkPeriodEndingDay></WorkPeriodEndingDay><br />
<TimesheetMeasurement></TimesheetMeasurement><br />
<ReportInterval></ReportInterval><br />
<AllowEmployeeRevision></AllowEmployeeRevision><br />
<AllowExpenses></AllowExpenses><br />
<AllowApproverRevisions></AllowApproverRevisions><br />
<TimesheetBranch ></TimesheetBranch><br />
<ApproverName></ApproverName><br />
<JobDescription></JobDescription><br />
<Corporation ></Corporation><br />
<MainOccupation ></MainOccupation><br />
<EmploymentType ></EmploymentType><br />
<TimeSheetFormat><br />
<Name></Name><br />
</TimeSheetFormat><br />
<WorkingDays></WorkingDays><br />
</CompanyExtn><br />
</UserArea><br />
</StaffingOrganization>
I want to add namespace to the node StaffingOrganisation
please help
Dream it to achieve it
|
|
|
|
|
Nice blank space you got there... do you perchance have html enabled in your post? (ie. you didn't tick the box saying 'Ignore HTML tags in this message' )
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
I developed a desktop application in C#.Net using VS2005.
On one of the form,
On double clicking a Listview, the selected file is opened with the selected application. MSWORD for .doc and WinZip for .Zip
This works perfectly in XP,2003 and other platforms except vista.
The files which i want to open is in the application folder, c:programfiles/myapp.
The problem is Compatibility files.
Can any one help me out??
How can i make my application compatible with Vista ?
Avanish
|
|
|
|