Click here to Skip to main content
15,898,134 members
Home / Discussions / C#
   

C#

 
GeneralRe: getting country location based on IP address Pin
uglyeyes6-Jan-10 10:57
uglyeyes6-Jan-10 10:57 
GeneralRe: getting country location based on IP address Pin
uglyeyes12-Jan-10 15:41
uglyeyes12-Jan-10 15:41 
AnswerRe: getting country location based on IP address Pin
Ravi Sant14-Apr-11 1:50
Ravi Sant14-Apr-11 1:50 
GeneralThoughts on CrystalReports Pin
SusanP15-Jan-10 14:04
SusanP15-Jan-10 14:04 
GeneralRe: Thoughts on CrystalReports Pin
DaveyM695-Jan-10 14:32
professionalDaveyM695-Jan-10 14:32 
GeneralRe: Thoughts on CrystalReports Pin
SusanP15-Jan-10 14:36
SusanP15-Jan-10 14:36 
QuestionCryptographic Service Provider: How Do I Secure Machine-Level RSA Key Containers? Pin
Skippums5-Jan-10 11:58
Skippums5-Jan-10 11:58 
QuestionFile already Loaded, Save Pin
San245-Jan-10 9:33
San245-Jan-10 9:33 
Guys,

I`m working on a Windows application and running into a problem, can`t seem to figure it out. Let me first explain the app. Its a windows forms application with a Tab Controls. Each Tab Control is a single file and has other controls within it [tabcontrols, buttons, etc etc]. Based on the file extension only the First tab within the Tab Control changes everything else remains the same. Lets say like a Web browser with Tabs.

The problem I`m running into is - How do I stop duplicate tabcontrols [each tab control is a file] from opening. Lets say I load a file ABC.opt how do make sure ABC.opt is not loaded again..i.e, open by the software. I can load files now, but can`t seem to control the duplicates.
Also, when i Save a file..I want only the contents of the Tab Control open to be saved. Is there a Tab Control active property? What is the best way to do it. Something like a Web Browser..Lets say you open a website in a tab and click on Save on the Menu Strip, only the active Tab is saved.

Here is the code I`m working on.

//File Item Clicked from the MainMenuItem - This has File New, File Open, Save, Save As, etc
private void FileToolStripMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
FileToolStripMenuClicked(e.ClickedItem);
}

//FTSI - File Tool Strip Item Clicked
private void FileToolStripMenuClicked(ToolStripItem FTSI)
{


switch (FTSI.Name)
{

case "FileOpenTSMI":
// FileOpen.cs
FileOpen FO = new FileOpen();
FO.OpenFile();

break;

case "FileSave"
//See comments in ABCOpen

//Code here
break;


default:
break;
}
}




//Based on the Extention of the file the ABCOpen() or XYZOpen() functions are called
internal void OpenFile()
{
OpenFileDialog OFD = new OpenFileDialog();
OFD.InitialDirectory = @"C:\Cust";
OFD.Filter = "ABC Files|*.abc|XYZ Files|*.xyz";
OFD.CheckFileExists = true;
OFD.CheckPathExists = true;
OFD.RestoreDirectory = true;


if (OFD.ShowDialog() == DialogResult.OK)
{
switch (Path.GetExtension(OFD.FileName).Substring(1))
{
case "abc":
ABCOpen(OFD.FileName);
break;

case "xyz":
XYZOpen("OFD.FileName");
break;

default:
break;

}

}
}


private void ABCOpen(string FileName)
{
// Code here loads some User Controls




// Code here reads a File and then loads the data into Windows forms
// How do I save it in such a way that only the active tab control data is saved
// Lets say I loaded Sample.abc and Test.xyz. I edit Sample.abc and it is the active Tab, and when I hit save how can I make sure only Sample.abc data is written into the file?

}


Any ideas, help are greatly appreciated.

Thanks!
AnswerRe: File already Loaded, Save Pin
Not Active5-Jan-10 9:45
mentorNot Active5-Jan-10 9:45 
AnswerRe: File already Loaded, Save Pin
Skippums5-Jan-10 12:12
Skippums5-Jan-10 12:12 
QuestionStreams and Cryptography (Padding is invalid and cannot be removed) Pin
Skippums5-Jan-10 9:26
Skippums5-Jan-10 9:26 
GeneralRe: Streams and Cryptography (Padding is invalid and cannot be removed) Pin
Skippums5-Jan-10 9:40
Skippums5-Jan-10 9:40 
GeneralRe: Streams and Cryptography (Padding is invalid and cannot be removed) Pin
Paulo Zemek5-Jan-10 10:09
Paulo Zemek5-Jan-10 10:09 
AnswerRe: Streams and Cryptography (Padding is invalid and cannot be removed) Pin
Skippums5-Jan-10 10:30
Skippums5-Jan-10 10:30 
QuestionNeed help! How to draw waveform of the sound when playing video! Pin
die_for_rock_vn5-Jan-10 7:23
die_for_rock_vn5-Jan-10 7:23 
AnswerRe: Need help! How to draw waveform of the sound when playing video! Pin
Roger Wright5-Jan-10 20:02
professionalRoger Wright5-Jan-10 20:02 
Questionenumerate used com Pin
abalbo5-Jan-10 3:21
abalbo5-Jan-10 3:21 
AnswerRe: enumerate used com Pin
Keith Barrow5-Jan-10 7:15
professionalKeith Barrow5-Jan-10 7:15 
GeneralRe: enumerate used com Pin
abalbo5-Jan-10 16:11
abalbo5-Jan-10 16:11 
QuestionDetecting music keys from keyboard in winform app Pin
Wheels0125-Jan-10 2:22
Wheels0125-Jan-10 2:22 
AnswerRe: Detecting music keys from keyboard in winform app Pin
Covean5-Jan-10 3:11
Covean5-Jan-10 3:11 
GeneralRe: Detecting music keys from keyboard in winform app Pin
Wheels0125-Jan-10 3:18
Wheels0125-Jan-10 3:18 
GeneralRe: Detecting music keys from keyboard in winform app Pin
Covean5-Jan-10 3:51
Covean5-Jan-10 3:51 
GeneralRe: Detecting music keys from keyboard in winform app Pin
Wheels0125-Jan-10 4:09
Wheels0125-Jan-10 4:09 
GeneralRe: Detecting music keys from keyboard in winform app Pin
Covean5-Jan-10 4:16
Covean5-Jan-10 4: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.