Click here to Skip to main content
15,881,281 members
Home / Discussions / C#
   

C#

 
AnswerRe: Generate Textbox on runtime Pin
OriginalGriff10-Mar-22 0:12
mveOriginalGriff10-Mar-22 0:12 
GeneralRe: Generate Textbox on runtime Pin
Saim Ullah 202110-Mar-22 0:34
Saim Ullah 202110-Mar-22 0:34 
GeneralRe: Generate Textbox on runtime Pin
OriginalGriff10-Mar-22 1:08
mveOriginalGriff10-Mar-22 1:08 
GeneralRe: Generate Textbox on runtime Pin
Saim Ullah 202110-Mar-22 7:59
Saim Ullah 202110-Mar-22 7:59 
AnswerRe: Generate Textbox on runtime Pin
RedDk10-Mar-22 8:26
RedDk10-Mar-22 8:26 
GeneralRe: Generate Textbox on runtime Pin
Richard MacCutchan10-Mar-22 22:21
mveRichard MacCutchan10-Mar-22 22:21 
GeneralRe: Generate Textbox on runtime Pin
RedDk11-Mar-22 8:06
RedDk11-Mar-22 8:06 
QuestionC# File.Create terminating WimForm app wiith no error thrown ? Pin
BillWoodruff8-Mar-22 5:03
professionalBillWoodruff8-Mar-22 5:03 
Update: revised code to use full Type names, not var; used hard-coded filepath.

Now, in VS 2019 using FW 4.8, File.Create terminates the app with no error message. I tried wrapping the call in a Try/Catch: terminates the app without ever reaching the Catch clause.

Note: i can't find any error reports on the behavior of File,Create described here.

A few years ago, the code shown here was a standard part of the serialization library i wrote, and worked fine. The other part of the library, which uses XML serialization, works without errors.

Note: the code shown compiles, but, fails in the first 'using block. File,Create moved outside the using statement also fails the same way. So, there's nothing specifically GZippy where the code fails.

// reqiured usings
using System.IO;
using System.IO.Compression;
using System.Runtime.Serialization;

public static void GZSerialize<T>(T instance, string baseFolderPath, string filename1)
{
    dcs = new DataContractSerializer(typeof(T));

    string fullfilename = baseFolderPath + "/" + filename1 + (usegzip + @".gz";

    //if (File.Exists(fullfilename ))
    //{
        //File.Delete(fullfilename );
    //}

    string fullfilename = @"C:\Users\Win-Ten\Desktop\fordata\test4.gz";

    // fails here
    using (FileStream compressedFileStream = new FileStream(fullfilename, FileMode.OpenOrCreate, FileAccess.Write))
    {
        using (GZipStream compressionStream =
               new GZipStream(compressedFileStream, CompressionLevel.Optimal, true))
        {
            dcs.WriteObject(compressionStream, instance);
            compressionStream.Close();
        }
    }
}

«The mind is not a vessel to be filled but a fire to be kindled» Plutarch


modified 8-Mar-22 16:14pm.

AnswerRe: C# File.Create terminating WimForm app wiith no error thrown ? Pin
Pete O'Hanlon8-Mar-22 5:24
mvePete O'Hanlon8-Mar-22 5:24 
GeneralRe: C# File.Create terminating WimForm app wiith no error thrown ? Pin
BillWoodruff8-Mar-22 6:27
professionalBillWoodruff8-Mar-22 6:27 
GeneralRe: C# File.Create terminating WimForm app wiith no error thrown ? Pin
Pete O'Hanlon8-Mar-22 20:42
mvePete O'Hanlon8-Mar-22 20:42 
GeneralRe: C# File.Create terminating WimForm app wiith no error thrown ? Pin
BillWoodruff8-Mar-22 21:19
professionalBillWoodruff8-Mar-22 21:19 
AnswerRe: C# File.Create terminating WimForm app wiith no error thrown ? Pin
Richard Deeming8-Mar-22 21:49
mveRichard Deeming8-Mar-22 21:49 
GeneralRe: C# File.Create terminating WimForm app wiith no error thrown ? Pin
BillWoodruff8-Mar-22 22:08
professionalBillWoodruff8-Mar-22 22:08 
AnswerRe: C# File.Create terminating WimForm app wiith no error thrown ? Pin
Randor 9-Mar-22 9:05
professional Randor 9-Mar-22 9:05 
GeneralRe: C# File.Create terminating WimForm app wiith no error thrown ? Pin
BillWoodruff9-Mar-22 9:29
professionalBillWoodruff9-Mar-22 9:29 
GeneralRe: C# File.Create terminating WimForm app wiith no error thrown ? Pin
Randor 9-Mar-22 9:36
professional Randor 9-Mar-22 9:36 
GeneralRe: C# File.Create terminating WimForm app wiith no error thrown ? Pin
BillWoodruff9-Mar-22 22:00
professionalBillWoodruff9-Mar-22 22:00 
GeneralRe: C# File.Create terminating WimForm app wiith no error thrown ? Pin
Randor 9-Mar-22 22:56
professional Randor 9-Mar-22 22:56 
Answersolved thanks to Randor ... but, it's a kinky one ! Pin
BillWoodruff10-Mar-22 3:23
professionalBillWoodruff10-Mar-22 3:23 
PraiseRe: solved thanks to Randor ... but, it's a kinky one ! Pin
Randor 11-Mar-22 12:27
professional Randor 11-Mar-22 12:27 
GeneralRe: solved thanks to Randor ... but, it's a kinky one ! Pin
BillWoodruff11-Mar-22 17:04
professionalBillWoodruff11-Mar-22 17:04 
Questionc# programming Pin
Member 155562105-Mar-22 5:01
Member 155562105-Mar-22 5:01 
AnswerRe: c# programming Pin
Dave Kreskowiak5-Mar-22 5:13
mveDave Kreskowiak5-Mar-22 5:13 
AnswerRe: c# programming Pin
OriginalGriff5-Mar-22 5:56
mveOriginalGriff5-Mar-22 5:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.