Click here to Skip to main content
15,903,856 members
Home / Discussions / C#
   

C#

 
Generalconvert ASCII into char Pin
devvvy10-Sep-03 7:17
devvvy10-Sep-03 7:17 
GeneralRe: convert ASCII into char Pin
Julian Bucknall [MSFT]10-Sep-03 8:50
Julian Bucknall [MSFT]10-Sep-03 8:50 
GeneralRe: convert ASCII into char Pin
berndg10-Sep-03 8:53
berndg10-Sep-03 8:53 
GeneralGet Content of Panel as Bitmap Pin
Mazdak10-Sep-03 6:28
Mazdak10-Sep-03 6:28 
GeneralText processing and parsing Pin
Den2Fly10-Sep-03 5:34
Den2Fly10-Sep-03 5:34 
GeneralRe: Text processing and parsing Pin
David Stone10-Sep-03 5:39
sitebuilderDavid Stone10-Sep-03 5:39 
GeneralThank you so much. /nt Pin
Den2Fly10-Sep-03 6:24
Den2Fly10-Sep-03 6:24 
GeneralWebService called by Java client Pin
Anonymous10-Sep-03 5:28
Anonymous10-Sep-03 5:28 
GeneralRe: WebService called by Java client Pin
Xiangyang Liu 刘向阳10-Sep-03 15:38
Xiangyang Liu 刘向阳10-Sep-03 15:38 
GeneralAsync model question Pin
Ryan Cromwell10-Sep-03 5:05
Ryan Cromwell10-Sep-03 5:05 
GeneralRe: Async model question Pin
Eric Gunnerson (msft)10-Sep-03 12:16
Eric Gunnerson (msft)10-Sep-03 12:16 
GeneralRe: Async model question Pin
Ryan Cromwell10-Sep-03 13:35
Ryan Cromwell10-Sep-03 13:35 
Generalsimple question... Pin
.gonad10-Sep-03 4:28
.gonad10-Sep-03 4:28 
GeneralRe: simple question... Pin
Nick Seng10-Sep-03 16:12
Nick Seng10-Sep-03 16:12 
GeneralEuros and decimal.Parse Pin
Simon_uk10-Sep-03 3:23
Simon_uk10-Sep-03 3:23 
GeneralRe: Euros and decimal.Parse Pin
Simon_uk10-Sep-03 22:34
Simon_uk10-Sep-03 22:34 
GeneralRe: Euros and decimal.Parse Pin
Member 9611-Sep-03 18:30
Member 9611-Sep-03 18:30 
GeneralStandardPrinter Pin
gecko2310-Sep-03 3:14
gecko2310-Sep-03 3:14 
GeneralUsing ODBC databases Pin
Emilio Guijarro10-Sep-03 3:10
Emilio Guijarro10-Sep-03 3:10 
GeneralRe: Using ODBC databases Pin
joan_fl10-Sep-03 4:19
joan_fl10-Sep-03 4:19 
GeneralRe: Using ODBC databases Pin
Emilio Guijarro10-Sep-03 5:31
Emilio Guijarro10-Sep-03 5:31 
GeneralRe: Using ODBC databases Pin
David Stone10-Sep-03 5:37
sitebuilderDavid Stone10-Sep-03 5:37 
GeneralHelp: Object reference not set to an instance of an object. Pin
gros194410-Sep-03 1:30
gros194410-Sep-03 1:30 
Here's part of my project:

public class NetworkStats
{
private Form1 form;
private AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer player;
private ConfigResult cf;

public NetworkStats(Form1 form1, AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer player1, ConfigResult cf1)
{
form = form1;
player = player1;
cf = cf1;
}

public FileStruct FileStats()
{
string path;
DirectoryInfo dir;
FileStruct fs = new FileStruct();

path = cf.pathLog + "\\" + player.currentMedia.name + "\\";
dir = new DirectoryInfo(cf.pathLog);
dir.CreateSubdirectory(player.currentMedia.name);

if(cf.buffCount)
{
try
{
fs.fileStats = new FileStream(path + "Stats.txt", FileMode.Create, FileAccess.Write);
fs.swStats = new StreamWriter(fs.fileStats);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}

if(cf.currBW)
{
try
{
fs.fileBW = new FileStream(path + "currBW.txt", FileMode.Create, FileAccess.Write);
fs.swBW = new StreamWriter(fs.fileBW);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}

if(cf.currBR)
{
try
{
fs.fileBR = new FileStream(path + "currBR.txt", FileMode.Create, FileAccess.Write);
fs.swBR = new StreamWriter(fs.fileBR);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}

if(cf.currFR)
{
try
{
fs.fileFR = new FileStream(path + "currFR.txt", FileMode.Create, FileAccess.Write);
fs.swFR = new StreamWriter(fs.fileFR);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}

return fs;
}

public void initStats()
{
FileStruct fs;

fs = FileStats();

while (Form1.videoParat != true)
{
try
{
form.BitRate.Text = (player.network.bitRate).ToString() + " Bps";
if(cf.currBR)
{
fs.swBR.WriteLine(player.network.bitRate.ToString() + " " + player.controls.currentPositionString);
}

form.BW.Text = (player.network.bandWidth).ToString() + " Bps";
if(cf.currBW)
{
fs.swBW.WriteLine(player.network.bandWidth.ToString() + " " + player.controls.currentPositionString);
}

form.buffCount.Text = (player.network.bufferingCount).ToString();
form.buffProgress.Text = (player.network.bufferingProgress).ToString();
form.buffTime.Text = (player.network.bufferingTime).ToString() + " mseg";
form.downProgress.Text = (player.network.downloadProgress).ToString() + " %";

form.currentFR.Text = (player.network.frameRate).ToString() + " FPS";
if(cf.currFR)
{
fs.swFR.WriteLine(player.network.frameRate.ToString() + " " + player.controls.currentPositionString);
}

form.encodFR.Text = (player.network.encodedFrameRate).ToString() + " FPS";
form.framesSkip.Text = (player.network.framesSkipped).ToString();
form.lostPackets.Text = (player.network.lostPackets).ToString();
form.rxQuality.Text = (player.network.receptionQuality).ToString();
form.sourceProtocol.Text = (player.network.sourceProtocol);
form.rxPackets.Text = (player.network.receivedPackets).ToString();
form.recoveredPackets.Text = (player.network.recoveredPackets).ToString();
form.maxBW.Text = (player.network.maxBandwidth).ToString() + " Bps";
fs.swStats.WriteLine("prova");
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
//escriure la resta d'estadístiques
try
{
fs.swStats.WriteLine("prova 2"); <--------
fs.swBR.WriteLine("prova");
fs.swStats.WriteLine("prova 3");
fs.swBW.WriteLine("prova");
fs.swStats.WriteLine("Buffering Count: ");
}
catch (Exception e)
{
MessageBox.Show(e.Message);
Console.WriteLine(e.Message);
}

fs.Close();
}
}

public class FileStruct
{
public FileStream fileBW;
public StreamWriter swBW;
public FileStream fileBR;
public StreamWriter swBR;
public FileStream fileFR;
public StreamWriter swFR;
public FileStream fileStats;
public StreamWriter swStats;

public void Close()
{
try
{
swBW.Close();
swBR.Close();
swFR.Close();
swStats.Close();
fileBW.Close();
fileBR.Close();
fileFR.Close();
fileStats.Close();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}

The problem is that when arrives to "fs.swStats.WriteLine("prova 2");" it gets the "object reference..." exception, and I can't write anything to the output file....I really don't know what to do!!! Frown | :(

Please, if anyone has any idea, I'd be really grateful!!!! Sigh | :sigh:
GeneralRe: Help: Object reference not set to an instance of an object. Pin
Julian Bucknall [MSFT]10-Sep-03 5:07
Julian Bucknall [MSFT]10-Sep-03 5:07 
GeneralRe: Help: Object reference not set to an instance of an object. Pin
gros194412-Sep-03 1:16
gros194412-Sep-03 1:16 

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.