Mr_White's Q&A profile
Visual C# Writing to file after using OpenFileDialog.
I've been trying to figure this out ever since .NET 1.1 but have always had the same problem. I've got a button that calls ShowDialog on an OpenFileDialog. When I do this, select a file and click open I'm no longer able to write anything to a file. A basic example of what I'm trying to do is click the button, have the user select a file. Get the path to that file from the OpenFileDialog, and save that file to a test document. I want to write it to a config file like this: FileStream file = new FileStream("Config.xml", System.IO.FileMode.Create, System.IO.FileAccess.Write); StreamWriter sw = new StreamWriter(file); sw.Write(openFileDialog.FileName); sw.Close(); This works if I never make a call to ShowDia ...Show All
Visual C# How to use the controls from another form in form I working in.
I have problem, I was using the Visal Basic, and now have to migrate to the C#. Its not a problem. But in first steps with C# I have found a few diferences from VB. One I cant solve. For example in Form1 I have a TextBox1 and a Button1. I enter in TextBox1 "sviec", and click the Button1. Then opens the Form2 with Label1 on it and label says "sviec". In VB the Form2 code looks like this: Public Class Form2 Private Sub Form1_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase .Load Me .Label1.Text = Form1.TextBox1.Text End Sub End Class So how I can translate this Me .Label1.Text = Form1.TextBox1.Text from VB to C# Thank You! ...Show All
Windows Forms combobox
Hello A problem! I am trying to do the tutorial about two tables (master/detail) lookup. but it will not work. Everytime when i changing a value on combobox (child table is updated corectly) but combobox (parent) datasource is updating also. like this combobox list at start 1 test (displaying item in combobox) 2 test2 3 test3 then when i change to "test2" the list will look like this: 1 test2 (displaying item in combobox) 2 test2 3 test3 someting is wrong here! please help. Hi Yea I did some more thinking when the first reply was about parent relation, so I did some reading. Thanks to all for a fast reply and creative foruming. ...Show All
Visual Studio Team System I can't get environment variables to work in 1.35
I couldn't get environment variables to work in FxCop 1.35. Not sure what I'm doing wrong. Here's what I've tried. * start a command prompt from a batch file that sets up various environment variables that we use in our build environment. * launch FxCop from that command prompt. * Add a reference to an assembly DLL. * Right-click on the target and choose Properties. * Change the save name to replace the first part of the path with the environment variable that has that part of the path as its value. * save the project out to a file. * Quit out of FxCop and open up the project file in Notepad. * Note that the Name attribute for the target is now shown as relative to $(FxCopDir), not the environment variable that I ha ...Show All
Windows Forms Custom calendar control - how to populate?
I want to make a custom calendar control similar to the MonthCalendar control, but using a DataGridView instead, so that I can set the background color for individual days. How can I populate my DGV with dates ie. where do I get date info from Can someone show me a quick code sample that will do this Thanks... here is a link that tells about a sample calendar control using the datagrid view. may be you can use it or it might be helpful in desiging you app. http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=135160&SiteID=1 ...Show All
Visual Studio Express Editions Questions / Answers : Evaluation Outlines !!!
I am developing an ITS System , in the Evaluation Stage , can someone help me with the outlines for developing the evaluation : What is the most approciate way for storing the Questions and Answers : Multiple Choices , TRUE / FALSE , and any other Questions and Answers form and ... What is the best way for Representing the Questions and Answers to the Learner and ... Finally Thank you so much :) Well you have to replace QuestionText by the name you gave the field in the dataset designer. Question_Text You can declare currentPosition as a member of the class. ie private int currentPosition = 0; Charles ...Show All
Smart Device Development execute application
how can i build appliction for execute it for pocket pc wen i finish my design ...Show All
Windows Forms Formatting a string for a RichTextBox
In my windows form application I have a rich text box that displays the cpu usage every second. If the cpu usage rises above 90% I want to display a line of text in **red font color**. I just don't know how to format a string to give it color. I know the rich textbox supports this because it supports the coloration of links, ect. Any help is appreciated. Thanks. In this case, I think you'll have to use the RTF codes (look here for specification) to build a RTF text. To see, how this looks like, paste and run the following code: richTextBox1.Text = "** This is the error line **" ; richTextBox1.SelectAll(); richTextBox1.SelectionColor = Color .Red; MessageBox .Show(richTextBox1.Rtf); Andrej ...Show All
Visual Studio Opening a solution as 'Read Only'
Sorry if this isn't the right place for this, it seems to be the closest fit... I was just wondering if it's possible to open a solution and all it's files as 'read only'... I quite often have two instances of VS open, one of which I'm working on (the 'live' instance), the other I'm using just to look at some code (the 'reference' instance). The code I'm looking at contains common classes which I've developed and got in my GAC. I've got a bad habit though of looking at code in the reference instance and then going on to add a new class, delete an existing one or whatever... again in the reference instance, when I mean to do it in the 'live' instance. It would help me if I could open the reference instance read only so I couldn't do stup ...Show All
SQL Server New Guy Question 2: SQL on-the-fly at package runtime?
Here I go again...thanks for your patience... I'm trying to create a single, all-purpose SSIS package that would move data from a source database table to a matching target database table. The requirement is to create the package such that the SQL statement used by SSIS could be supplied at runtime. This would allow a single package to be used for different SQL statements, representing different tables, rows and columns, etc. as needed. The data movement combinations are highly variable, so I'm hoping to find a flexible one-size-fits-all solution with a single package. I've looked at setting up a string variable for the SQL statement, and populating it at runtime using a config file or command line SET statement. The package is initially ...Show All
.NET Development What is ObjRef object in remoting
What is ObjRef object in remoting All Marshal() methods return ObjRef object.The ObjRef is serializable because it implements the interface ISerializable, and can be marshaled by value. The ObjRef knows about :- √ location of the remote object √ host name √ port number √ object name. ...Show All
SQL Server how to enforce a trigger when update for each record when updates several records bulky?
I made a trigger on a table that fires when update happens, the trigger fires when attempting to update a single record (that is normally) but when trying to update several records bulky using one update statement it fires only once either. My question is, how to enforce firing the trigger for each record when updates bulky i.e. how to ensure that when I use the following update statement UPDATE MyTableName SET ColumnName = 5 And there are 10 records that affected; that the trigger would fire 10 times (I have the fact that it fires only once) In SQL server, a trigger fires once per statement, not per row and this can not be changed. You must write your trigger to be able to handle ...Show All
Visual C# Default Encoding
Hi, I am at the point in my appication where I am downloading an email attachment from an exchange server. I can save the attachment, but cannot open it. Does this have something to do with the default encoding type I am using StreamWritier to write to the file, here's the constructor: StreamWriter (String) Initializes a new instance of the StreamWriter class for the specified file on the specified path, using the default encoding and buffer size. Supported by the .NET Compact Framework. Any help is much appreciated ! Thanks arch_angel81, I think your problem is that you are trying to decode the bits of the zip file using UTF-8. This is quite likely to mangle your file, so that you ...Show All
.NET Development Calling an explicit interface member using reflection
I have an interface, MyInterface, with a method DoSomething. That interface takes a parameter of type DoSomethingArgs. I have another class, MyClass, that implements the interface, however it only operates on type MyDoSomethingArgs which inherits from DoSomethingArgs. For that reason, MyClass has two declarations of DoSomething: One which takes an argument of type MyDoSomethingArgs and another explicit interface version which takes an argument of type DoSomethingArgs. abstract class DoSomethingArgs { } class MyDoSomethingArgs : DoSomethingArgs { } interface IMyInterface { void DoSomething( DoSomethingArgs args); } class MyClass : IMyInterface { public void DoS ...Show All
SQL Server can't connect to SQLCMD
dear sirits my first time to work with SQL server 2005 i've installed it and tried to connect to sqlcmd by : run sqlcmd i got errors after that i logged to the database engine normally and created new database and tried again to relogin to the database engine but i failed and faced error:4064 i have three points needed to be answered : 1- SQLCMD loin problem 2- database engine error:4064 3- i need to import .mdb file to my new database regards 1. See your post http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=671937&SiteID=1&mode=1 2. The user you are currently trying to login with does not have the appropiate permissions to the assigned default database or the database does not exist an ...Show All
