DdoubleD 315 Posting Shark

open "My computer", go to "Tools" menu, "Folder options", "File types" tab, there is a list of all extentions, select the one you want to change, the select it and select "change" chose your program, If you don't have one, a the botom there is a place to select search the web for program.

SOLVED ITEM 1--BRAVO--THANKS!

,
send to:
Click Start /run and type,- shell:sendto - (press Enter)
From the File menu, click New, and then click Shortcut.
Follow the instructions in the Create Shortcut Wizard and create a shortcut to C:\Windows\Notepad.exe

SOLVED ITEM 2--BRAVO--THANKS!

DdoubleD 315 Posting Shark

Firstly, welcome!
Secondly, huh? LOL -- I've waited all day for someone to have a C# question, and you kill me with this?
Anyway, I have a vague (football and beer induced) sense that your if statement has the y and x comparison interchanged. Could that be it?

DdoubleD 315 Posting Shark

I ran into that StringBuilder code using StreamWriter on a another website. It's not going to work simply appending it to another word document. To understand why, do the following:

Set a breakpoint after the export of your CrystalReport and run program to there.

Open doc in Notepad, and look over the contents: note the length of the document, spacing, formatting, reference to CrystalReports, etc,. It's all viewable text, so you should have no problem.

Close notepad.

Now, open it in Word and go to the end of the document by hitting PgDn a few times. Do a Ctrl-Enter, which will insert a manual page break. PgDn into the new page.

Now, type in some text like: "some text", and save the document.

Now, open again in Notepad and notice the changes Word made to that document--it's pretty drastic. Not only does it create a bunch of new formatting script, it rearranges the existing script too. Search for the string "some text" and look at how it was embedded inside formatting code.

You are mingling data inside of an interprative format that must be formatted or reformatted correctly so that Word understands what to do. The reason that simple StringBuilder output to a stream probably works with a new file is because when Word first reads it, it will try to determine the format at that time, which is just HTML. However, when you append the HTML to the existing Crystal embedded document, it is not expecting information outside …

DdoubleD 315 Posting Shark

As an after thought, have you considered just adding a field to the end of your report that you can set to text "hany", or whatever, so that when it is exported it will properly format it in the word document? Not sure exactly what you need to do for your project, but a text field in the report or page footer section seems like it might be the way to go.

DdoubleD 315 Posting Shark

i have a problem in writing in word document the proble is that i want to append a string after a table i made in that document but it overides it...

Ok, your text is being appended to the word document, as you have told it to do. The problem is how Word is interpreting the document. When debugging, I saw that the string "hank" was indeed getting in the document, so I played with some formatting changes in the code and used BinaryWriter instead of StreamWriter so I could position the stream 1 position away from the EOF:

//StreamWriter sWriter = new StreamWriter(fStream);
            BinaryWriter sWriter = new BinaryWriter(fStream);
            sWriter.Seek(1, SeekOrigin.End);
            sWriter.Write("hany}");

Now, Word will display the appended text on a new page. Notice the addition of the closing brace in the text: "hany}". That is because I overwrote the closing brace already existing in the file (with Seek) and I wanted word to see "hany" before the final closing brace.

What you are dealing with at this point is Word scripting and you need to figure out how you can modify word documents externally or use some library that facilitates doing so, instead of using standard stream writers.

If the word "hany" is all you need appear at the end of the doc, and you wanted it to appear on the same page, you might be able to modify the export options to not fill the entire page with the table, then simply use the quick …

DdoubleD 315 Posting Shark

thanks alot
that's my project and it's databases
my code is supposed to make crystal report ,save it as a word document then append some words in that word document
would you just press "save report" in form1.cs then "save " in form2.cs the append code in save menustripitem handler in form2.cs

thanks alot for ur help it's really appreciated

I've compiled the project and am looking at the warnings, particularly the missing reference: Microsoft.Office.Interop.Word

I am installing the class library download and will get back to you...

DdoubleD 315 Posting Shark

Hi, I have two questions (Win XP):

1) I accidentally set a file's extension to open with the option "Always open with this app", or whatever the text is. Anyway, you can change it in the file's property dialog, but you cannot remove it. I want to remove it so that it will prompt to "browse the internet for appropriate viewer" or whatever the text is.

2) How do I modify the "Open with..." or "Send to..." option on the context menu to always include Notepad.exe?

Thanks,
David

DdoubleD 315 Posting Shark

Hi,
This Microsoft Technet page has some cool information to do just about anything in Windows XP.
Take a look here:-
http://www.microsoft.com/technet/itsolutions/howto/winxphow.mspx

This link appears to no longer be valid.

DdoubleD 315 Posting Shark

Just FYI:

I believe this practice was carried over as the C# language was developed. In C/CPP, I got into the habit of putting in the comma after the last definition for a few reasons:

1) easier editing when you want to append to list of enums
2) easier editing when you want to reorder with cut and paste
3) easier editing when you want to search and replace, such as wanting to append characters to the end of selected items you would just replace the "," with "_FLD," or "_SIZ", etc.

In addition, we would often place a final definition to indicate the total definitions (eg. TOTFIELDS). This last entry was very useful for loops and allocations. Not so much now as C# makes life so much easier, but I still do this. However, in this particular case, you would definitely want to leave off the trailing comma because you would never want to append a definition past the TOTFIELDS.

ddanbe commented: Thanks for the extra clarification! +8
sknake commented: interesting +8
DdoubleD 315 Posting Shark

I am receiving this exception

(An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)


plz help

Did you check the SQL Server setup (via the link I gave you below) to ensure you have the proper connections enabled?

Do you have local and remote connections enabled for the server?
If you are not sure, check out this link: Setup (click mouse here to view link)

DdoubleD 315 Posting Shark

actually they did nothing i don,t know why but any way appreciated
sorry for replying lately

No problem. When you say "did nothing", I really don't know what that means.

I'm not sure if know, but you can append to any file you want. However, that doesn't mean that the reader (MS Word in this case) of the file will understand the data appended.

Anyway, if you will post your code so I can run it on my end, I will help you figure it out.

DdoubleD 315 Posting Shark

Thank you but how would I pass the vars of the Numericupdown(in form sp+ it needs to be the selected string in there) to label2 (in form1),and I want to show that selected string from numeric' in label 2 when button on sp is pressed, I can't find how to do it.

Because NumericUpDown.Value is type 'decimal', you need to convert to and from type 'string' to store and retrieve from labels, textboxes, etc.

numericUpDown1.Value = Convert.ToDecimal(myString);
//and convert a decimal to string:
            myString = Convert.ToString(numericUpDown1.Value);

So, you can decide how you want to pass the value between the forms because the conversion is quite easy.

Be sure to consider my recommendation for putting your shared vars in a class (e.g. class MyVars or something). Otherwise, you are eventually going to find the vars are not referencing the same data on both forms.

DdoubleD 315 Posting Shark

DdoubleD's post, i think is what you really needed.

But I think this is what you are looking for

//SP Form
   public string x;
   public string y;

    public class SP : Form
    {
        Form1 form = new Form1(x,y);
        form.Show();
    }

//Form1

   string x,y;
   public Form1(string x, string y)
  {
     this.x = x;
     this.y = y;
  }

correct me if I'm wrong

That will work as long as second form does not modify the variables because when the strings get assigned they will get assigned new strings and thus a different reference from the starting variables.
This is why I placed the variables inside class MyVars.

DdoubleD 315 Posting Shark

If both of these apps exist within the same solution, it's pretty easy to do. You can reference another exe the same as you do a dll and vice-versa.

DdoubleD 315 Posting Shark

OK. Both of us provided links to completely working projects--did you not find you could unzip and build, then run either of the programs without error?

DdoubleD 315 Posting Shark

The code from either of those programs can be modified to countdown from 5000 of whatever you want and then execute code. What is the problem/error you are getting?

DdoubleD 315 Posting Shark

ugh, I used that link from double's post, I was doing everything fine, and it was working out okay until it told me i was getting errors so I was like wtf...

Isn't there a more simple way to do this. I don't know but like just having the timer and set the interval to like 5000 and start it, so that once button is clicked, itll count down 5 seconds and then continue?

I've tried both the link I gave you and sknake's, and I thought both were working fine. What are the errors you got with the link I provided?

DdoubleD 315 Posting Shark

sknake I tried using your code, but I got some errors. I'll try to use DdoubleD's now =]

sknake, can you include the designer.cs portion?

DdoubleD 315 Posting Shark

He wasn't. Not everyone here knows english as their first language so sometimes it may just come across that way. Adatapost was just helping out. You'll know if he gets snappy :P

Yea, you are probably right.:-/

DdoubleD 315 Posting Shark

This downloadable project seems to do everything you want: Countdown Project

DdoubleD 315 Posting Shark

It can be. I have service applications that use SQL connectors and as we all well know you cannot debug services. So for debugging I run my service application as a console application and when its ready to ship I just install it as a service.

You can run any code from any assembly really unless you get in to the presentation-layer specific code such as trying to instantiate a windows form in a web application, or a WebPage in a form application. For any of the System.Drawing and similar namespaces you just need to add a reference. VS doesn't add the same references to each project by default because more than likely you don't use drawing in a console application (unless you're writing a service that emails pictures and are running it as a dos application!).

I agree. I wonder why the smiling bear was so snappy.... Vinegar in his honey?

DdoubleD 315 Posting Shark

Have you opened the report in the designer/editor and looked at what is defined in the sections above the body (details)? It could be many things (Report, Page, or Group headers for example). If you can't figure it out, attach the .rpt file for examination.

DdoubleD 315 Posting Shark

I did mention that i'm a newB in C# programming. When i go through its tutorial, they did mention that c# can be running in console. So i just wanna see it in different approach. I dont think it's wrong when u wanna discover something new since i'm still beginner in this languages. But thanks for the advice.

Did you find that you could run the database interface in either console or Window's Form without problem?

DdoubleD 315 Posting Shark

Ask your lead whether there is a resource library/module containing quad-panels and other shapes in which he/she would extract these controls from. To just say something is possible is very vague because anything is possible, but I doubt they expect you to write these controls from scratch--or at least they shouldn't without good cause.

Or, are you just being asked to create a box with four divisions and some circles of particular sizes and center positions drawn in them?

DdoubleD 315 Posting Shark

i havent done it, my lead says its possible in vc++, he is asking me if i can do it here in dotnet,
i just want the it from the tool box.
just the front end design..

Ask your lead whether there is a resource library/module containing quad-panels and other shapes in which he/she would extract these controls from. To just say something is possible is very vague because anything is possible, but I doubt they expect you to write these controls from scratch--or at least they shouldn't without good cause.

DdoubleD 315 Posting Shark

Glad to have helped. Can you please mark as SOLVED. Thanks.

DdoubleD 315 Posting Shark

Well, that and I noticed there were new posts that got my curiosity, so only seemed appropriate.:icon_cheesygrin:

DdoubleD 315 Posting Shark

I was thinking of replacing the symbol in the script itself.
If textbox1.text not null then display in the label.
Same goes to textbox2.text but with the symbol. Now when textbox2.text is cleared then remove symbol. Right?

If that syntax is correct for the scripting language, then you are on the right track.

DdoubleD 315 Posting Shark

Brilliant! I was actually working like that. But now the problem is when the user deletes the text in the textbox the ',' should also go right?

How to remove that?

Well, now that's a good question. I haven't programmed in ASP.NET, VB or Java script. That function I wrote (UpdateLabel2) isn't exactly C# code, and it took me a while to figure that out. Do you know VB or Java script?

I think a good way to handle it would be to create another script function that accepts a string, then returns another string, with or without the comma (or other delimiter), depending on whether the passed in string is blank (empty). You could then substitute this new function call in place of each of the three textbox (and comma literal) references in the concatentation within the UpdateLabel2() function.

Make sense?

DdoubleD 315 Posting Shark

me too

DdoubleD 315 Posting Shark

You can just modify the function to concatenate the values and call it to process keyup events for all three textboxes:

protected void Page_Load(object sender, EventArgs e)
        {
            String scriptText = "";
            scriptText += "function UpdateLabel2(){";
            scriptText += "   Label1.innerText = " +
                " document.forms[0].TextBox1.value + ',' + " + 
                " document.forms[0].TextBox2.value + ',' + " +
                " document.forms[0].TextBox3.value";
            scriptText += "}";
            this.ClientScript.RegisterClientScriptBlock(this.GetType(),
               "OnKeyUpScript", scriptText, true);
            TextBox1.Attributes.Add("onkeyup", "UpdateLabel2()");
            TextBox1.Attributes.Add("onblur", "UpdateLabel2()");
            TextBox2.Attributes.Add("onkeyup", "UpdateLabel2()");
            TextBox2.Attributes.Add("onblur", "UpdateLabel2()");
            TextBox3.Attributes.Add("onkeyup", "UpdateLabel2()");
            TextBox3.Attributes.Add("onblur", "UpdateLabel2()");
        }
DdoubleD 315 Posting Shark

Thankyou very much. It works like charm!
But this works with one text box. How can I do with 3 textboxes?

OK. You need to concatenate all three textboxes into the one label?

DdoubleD 315 Posting Shark

I thought I sent this a few minutes ago, but I guess not. Here is another way to do it in the asp form's page load and without the Java function:

protected void Page_Load(object sender, EventArgs e)
        {
            String scriptText = "";
            scriptText += "function UpdateLabel2(){";
            scriptText += "   Label1.innerText = " +
                " document.forms[0].TextBox1.value";
            scriptText += "}";
            this.ClientScript.RegisterClientScriptBlock(this.GetType(),
               "OnKeyUpScript", scriptText, true);
            TextBox1.Attributes.Add("onkeyup", "UpdateLabel2()");
            TextBox1.Attributes.Add("onblur", "UpdateLabel2()");
        }
DdoubleD 315 Posting Shark

OK, 1st how could I actually change the label?
2 Where to put that code you gave me?

To change a label's text:

label1.Text = "some new text";

or,

label1.Text = myVars.text1;

As far as where to put that other code, I thought it was self-explanatory, but I would need to see your actual code to be more specific. If you post your code, I'll try to help with that.

DdoubleD 315 Posting Shark

Note the attributes for the TextBox:
onblur: control losing focus
onkeyup: after each keystroke

The value "UpdateLabel();" tells it to run that script upon those events.

<head runat="server">
    <title></title>
</head>
<script type="text/javascript">
function UpdateLabel()
{
document.getElementById('Label1').innerText = document.getElementById('TextBox1').value;
}
</script>
<body>
    <form id="form1" runat="server">
    <div style="height: 83px">
			<br />
			<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
			<asp:TextBox ID="TextBox1" runat="server" onblur="UpdateLabel();" onkeyup="UpdateLabel();">
			  </asp:TextBox>
    </div>
    </form>
</body>
DdoubleD 315 Posting Shark

I know how to open a form but I asked how could I transfer from From2 that has a list box the selected item from the list box , and when button that transfers is pressed to show the value of the selected listbox item in the label in form1.

If you understand the MyVars code I gave you, try to make it work and show your code with questions or problems you have. It sounds like you want someone else to write the code for you, but we don't do that.

DdoubleD 315 Posting Shark

What do you mean call?
Could you give me an example code?(for my 1st question..)

There are soooo many ways to do this. Here is one technique:

public class MyVars
        {
            public string text1;
            public string text2;
        }

    public class Form1 : Form
    {
        MyVars myVars = new MyVars();

        SP sp = new SP (myVars);
    }

The above will pass a MyVars object to your SP form, which can be modified and the changes will be available to Form1.

DdoubleD 315 Posting Shark

In other words, inside of Form1's class, you create form "SP", such as:

SP sp = new SP();
sp.ShowDialog();
DdoubleD 315 Posting Shark

Does this label1.Text need to be updated after each key stroke in the TextBox, or can it be updated after user has finished editing?

DdoubleD 315 Posting Shark

There are several ways to do this. Does form1 call form SP?

DdoubleD 315 Posting Shark

Here is code that will do what you originally asked. Just set your richTextBox1.Text = webHTMLText;, after running it.

string webHTMLText;
            WebClient webClient = new WebClient();

            using (MemoryStream ms = new MemoryStream(webClient.DownloadData("http://daniweb.com/")))
            {
                using (StreamReader sr = new StreamReader(ms))
                {
                    webHTMLText = sr.ReadToEnd();
                    sr.Close();
                }
            }

If there is specific text you want from this before you put it into the control's Text, you would need to know exactly what tags to parse it out of.

DdoubleD 315 Posting Shark

Look at the Validating and Validated events. The Validating event is generated when the user tries to leave the control and can be canceled if data doesn't pass checks. The Validated event will then be called only if the data passed in the Validating event. By comparing the old and new values, you know whether the data has actually been changed and you can retain a boolean for your form to know if data needs to be saved.

I meant this for TextBox controls--sorry, I need more coffee. Can you use those events for your spreads?

DdoubleD 315 Posting Shark

Look at the Validating and Validated events. The Validating event is generated when the user tries to leave the control and can be canceled if data doesn't pass checks. The Validated event will then be called only if the data passed in the Validating event. By comparing the old and new values, you know whether the data has actually been changed and you can retain a boolean for your form to know if data needs to be saved.

DdoubleD 315 Posting Shark

I'm not sure what is executing that when the error occurs, but I'm pretty sure that the error is telling you that the cell does not yet belong to the DataGridView. Is it possible that the operation is being performed before the column is added, or that the DataGridView itself is not yet created?

DdoubleD 315 Posting Shark

Show the code in the click event.

DdoubleD 315 Posting Shark

Do you have local and remote connections enabled for the server?
If you are not sure, check out this link: Setup

DdoubleD 315 Posting Shark
myString.Replace("<Fresh Food>", "");
myString.Replace("</Fresh Food>", "");

Include newline if you want that removed too:

myString.Replace("<Fresh Food>\n", "");
DdoubleD 315 Posting Shark

I get the following message

"Operation can only be performed on cells that belong to a DataGridView control"

Compiling or at runtime? What line produces the error?

DdoubleD 315 Posting Shark

I'm providing this attachment because I've been searching all morning for flash related api stuff and have not found what I was looking for, but I happened upon this c# API. It is an example project in VS. I hope it will save you some time. Regards.

DdoubleD 315 Posting Shark

ok how do i check for previous versions

I believe this link will provide you with everything you need: Flash Player Dectection Kit