|
oops!... i am sorry ...yeah it is c++, presently i am workin on both simultaneously....so little bit messed up....anyway i hope we can implement on the same lines using C# headers in c#.
Suman
|
|
|
|
|
System.IO.StreamReader is the class you want. I suspect it has a ReadLine function, the StreamWriter certainly has a WriteLine function.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
This is so far what i have
private void openFileDialog1_FileOk(object sender, CancelEventArgs e)<br />
{<br />
string file = openFileDialog1.FileName;<br />
StreamReader sr = File.OpenText(file);<br />
int j = 0;<br />
char[] tempo;<br />
char tempchar;<br />
while (!sr.EndOfStream)<br />
{<br />
array2[j] = sr.ReadLine();<br />
listBox1.Items.Add(array2[j]);<br />
tempo = sr.ReadLine().ToCharArray();<br />
for (int k = 0; k < 35; k++)<br />
{<br />
tempchar = tempo[k];<br />
array[j, k] = tempchar;<br />
}<br />
j++;<br />
}
|
|
|
|
|
And what happens ?
It seems to me that you'd be better off using a dynamic arraylist than a fixed array.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
it reads and and loads the array into a textbox, it loads two types of arrays but it seems to not load the multidimensional array incorrectly, i want one char in the array, actually int.
|
|
|
|
|
i just had to do that for a project i'm working on. this is what i came up with:
System.IO.StreamReader sReader;<br />
System.Collections.ArrayList textArray;<br />
<br />
sReader = new System.IO.StreamReader(filename);<br />
textArray = new System.Collections.ArrayList();<br />
while(true)<br />
{<br />
string line = sReader.ReadLine();<br />
if(null != line)<br />
textArray.Add(line);<br />
else<br />
break;<br />
}<br />
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
|
Doh!!
|
|
|
|
|
|
does one exist? i thought i remember seeing one somewhere...
would this be difficult to do yourself?
|
|
|
|
|
Yeah.. it exists and I am pretty much sure of it seeing somewhere over this forum. I think it is not that much difficult to do, but i am not having code to show. Try searching on this forum using "listview combobox", i am sure u can find some useful articles on it.
Good Luck.
Suman
|
|
|
|
|
Yes, it's very difficult to do if you're using the ListView defined in the BCL. That encapsulates the Windows Common Controls List-View. Drawing iconic headers and colored cells isn't too hard, but siting other controls requires quit a bit of work.
There are third-party controls, however, that do this. They are more analogous to the DataGrid , but provide all the functionality of both plus more. Infragistics[^] and Developer Express[^] are just a couple of the third-party component developers that have such controls.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
|
I was hoping to be able to create something similar to a traditional ActiveX control that can be embeded into a web page so that my customers can go to a web page and have my control help fix problems on their computer with embedable WinForm controls.
To my disappointment it appears the security on embeded WinForms is a little lacking. It doesn't prompt the user on wether they want to trust my control. It automatically doesn't trust it and gives it very minimal rights. If they want to be able to use my control they have to manually adjust the .NET security on their computer.
The problem lies in the fact my customers barely know how to turn on their computer let alone doing anything like adjusting their security permissions. Have anyone been able to create a .NET control that is embedded on a web page that prompts the user for trusted permissions. Similar to that of a traditional ActiveX control found on Windows Update and the like.
If this isn't possible, then is it at least possible to create an ActiveX control in .NET that will do what I want? Ugh I dread the thought of having to write anymore ATL COM in C++ since .NET is so much easier to maintain and develop.
- Drew
|
|
|
|
|
Previously I was an architect that designed and developed a massive N-tier application using embedded Windows Forms controls and touchlessly-deployed Windows Forms Applciation and not once did customers have to manually change their CAS settings. You wrap this in an install. I wrote an Installer derivative that enumerate the Machine policy (all the code necessary is defined in the BCL) and added (or removed upon uninstall) our UrlMembershipCondition . This was executed as a custom action from Windows Installer (using VS.NET's Windows Installer projects - while severely limited in support for MSI features - makes this possible very easily).
.NET CAS doesn't prompt the user because users often make uninformed and ill-choices, clicking "Yes" to everything they read. It's a much tigher sandbox than what ActiveX has - if you can even call that a sandbox.
If you want more information on embeddeding Windows Forms controls - and even supporting client scripting (that depends on IE ActiveX security settings), read an old article of mine at http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=388[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
This means you had a seperate link that ran an .msi installation and changed their security settings to trust your url and any code on the page? If that is what I understand, then it isn't really touch-less than, correct? I really didn't want the customer to have to do anything but visit the site. The custom control I am developing needs access to the registry and/or the ability to run processes on the client machine. If I have misunderstood what you are saying you did then please let me know. The only way I see it is I would need a seperate executable they would need to download and run that would automatically change their security settings to allow my code to run with all permissions. If it is really that easy to do I dont see it as being much more secure.
-
Drew
|
|
|
|
|
Truly touchless deployment requires that your control only do what it is allowed to do (in .NET 1.0 this was nothing; thanks to the requests of several of us early adopters of touchless deployment, .NET 1.1 grants the Internet_Zone some permissions). There's simply no way around that (it's like being able to force installation of your ActiveX controls on unsuspecting clients - that's bad).
In .NET 2.0 there will be a technology called ClickOnce[^] that can save you from writing your own installation routine, but this won't be truly touchless either. It should - assuming no further changes - prompt the user to install an application and can update that application. The assemblies, however, are not downloaded in the same manner (i.e., automatic updates when IEExec checks for new versions of assemblies from their respective codebases).
There's just no getting around it: you can't force yourself on users; the framework won't allow it. If it did, then someone with malicous intent could force their malicous code on users, too.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I completely agree that forcing an application to run would be futile and very bad. That is not what I want or am I proposing. I did like the idea of allowing the user to select 'Yes' when an ActiveX control is loaded on a page. The control needs to be signed by the producer and the user needs to accept the control. This is much easier for my customers to understand as opposed to having to run another application to get permissions to run yet another control that is hosted on a web page.
In my case if they have to download an application that will automatically change their security settings then I might as well code the functionality I need into the application they need to download. I don't really need to do too much but I do need unrestrictive access. Specifically in the case that I am trying to solve I have many customers that are affected by the Office 2000 HTML Source Editing bug where it trys to install the dhtmled control when triedit is first loaded. The control already exists and doesn't need to be installed again. Also the customers have no idea where their CD is and don't understand why they need it to run an application developed by us.
I understand the reason's, but I'm not sure there are many real world products that will be able to run within the constraints of the security model currently in place. These applications would need to be thin clients that do all I/O and processing on the server. This is useful for those that wish to write thin clients but not those that want to run a full client side application from a web page.
In some sense I really wanted to be able to create a Windows Update type system in .NET, except it would update my product and anything else that needs to be fixed. There are many reasons I'm sure Microsoft themselves have still stuck with ActiveX controls, one being the fact that the .NET runtime isn't always installed and is installed through the Windows Update mechanism for most users.
I completely understand the security ramifications and agree with them, however it does seem nice when you would able to give your customer a URL, tell them to hit yes and that be it, especially when you spend hours explaining to them how to just turn on their computer.
This is where Microsoft gets into trouble all the time. They pick ease of use over security sometimes and I completely understand. The time will come when we don't have to pick one over the other but I don't think that time is now.
-
Drew
|
|
|
|
|
afinnell wrote:
I did like the idea of allowing the user to select 'Yes' when an ActiveX control is loaded on a page.
But as I said - from my experience in this field and from user studies into this problem, the vast majority of users will simply click "Yes" to whatever they are asked and most won't even understand unless you give them a long description that - because of the length - they probably won't read anyway.
afinnell wrote:
This is where Microsoft gets into trouble all the time. They pick ease of use over security sometimes and I completely understand. The time will come when we don't have to pick one over the other but I don't think that time is now.
Your problem is quite the opposite. With .NET Code Access Security, security takes a front seat to user experience, which is good for many reasons. For one - it's security. 'nough said.
Second is that smart-client development and deployment is more common in corporate networks where IT can push out security policies so the user doesn't have to worry about it.
ClickOnce bridges this gap and - if you think about it - is no different in terms of deployment than ActiveX controls (though it still uses a much better sandbox). The assemblies are downloaded and installed - just like ActiveX DLLs/OCXs/etc., or even Java JARs or .class files (if you're using the Microsoft JVM, which is now deprecated). It prompts the user.
ClickOnce is truly your answre here, but you could work around this problem by writing an ActiveX control that adds the code access policy (just an INF won't be enough since you need to modify CAS policy, which can be done directly to the .config file BUT BE CAREFUL and always backup the original).
In either case, they are not truly touchless. Using a strict touchlessly deployed application - unless you're doing something VERY basic (just look at the default privileges granted to the Internet_Zone in the Microsoft .NET Framework 1.1 Configuration snap-in) - is impossible for security-driven reasons.
I don't forsee this changing in our future until people change. It's practically impossible - even for AI (hey, bad people can fool humans, too) - to detect a malicious user from a decent user.
These are my opinions based on experience and research and not those of my employers.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
ClickOnce bridges this gap and - if you think about it - is no different in terms of deployment than ActiveX controls (though it still uses a much better sandbox). The assemblies are downloaded and installed - just like ActiveX DLLs/OCXs/etc., or even Java JARs or .class files (if you're using the Microsoft JVM, which is now deprecated). It prompts the user.
This is my fault for not being more dilegant with regards to reading about ClickOnce. This is almost exactly what I want. I'll just need to wait until .NET 2.0 comes out of beta. You are correct, ClickOnce really does bridge the gap. Thanks for bringing it to my attention.
Your problem is quite the opposite. With .NET Code Access Security, security takes a front seat to user experience, which is good for many reasons. For one - it's security. 'nough said.
I agree.
I don't forsee this changing in our future until people change. It's practically impossible - even for AI (hey, bad people can fool humans, too) - to detect a malicious user from a decent user.
I think this sums it all up. The focus will need to be on training people and not allowing them to do things that are unsecure just because they are ignorant on the subject matter. That's why we have the proliferation of virii everywhere.
This has been a very insightful conversation. I went in expecting the .NET 1.1 framework to already be up to standards in regards to web deployement, however I see that they are making great strides to achieve this in .NET 2.0.
Thanks
-
Drew
|
|
|
|
|
I am currently working on a server monitoring system. I need to know if it is possible to get the status of the backup using WMI.
If so, how can I get the status of the backup?
Any help would be greatly appriciated
"Every rule in a world of bits and bytes can be bend or eventually be broken"
|
|
|
|
|
TapeMiniWMIControl
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/storage/hh/storage/tapemini_37bf2bb8-34fb-422c-bcab-93c9585eae34.xml.asp
|
|
|
|
|
http://network.programming-in.net/articles/wmi.asp?wmi=CIM_TapeDrive
WMI class ' CIM_TapeDrive ' reference for C# and VB.NET
CIM_TapeDrive
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/cim_tapedrive.asp
|
|
|
|
|
Thanks for the tip
"Every rule in a world of bits and bytes can be bend or eventually be broken"
|
|
|
|
|
Hi I'm new to C# or to .net, right now im using 2.0, and I would like to know how to remove a certain element from an array, such as: array2[t]. also i would like to remove an element from a multidimensional array such as array[t,all 35 elements], note array2 is strings and array is all int's. PLZ help;P
|
|
|
|