|
As I said, it all depends on what you have available. For example, it could be stored in a database table (along with all the other details), or it could be something as simple as a file located on a network share. Without knowing your system I really cannot say.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks Ashfield. What i want is that on clicking a button PRINT the data in the BILL NO. textbox should be incremented and entered into a particular field of a database. I know how to enter the data from the textbox to the database . But the problem is that if i have entered 0 in the BILL NO. textbox and click the PRINT button, 1 is entered into the database field but when i close the application and run it again, the increment again starts from 0. I want that if the value in the textbox was 1 when the application was last run...it should be incremented to 2 when i run the application this time . i think i have made myself clear...but if u need any more background plz let me know...thanks for giving me the time
|
|
|
|
|
Well, if you enter the Bill No in a database, at the start of the program select the maximum bill no from the database and use that as your starting number rather than zero, and do not let the user enter it manually.
Hope this helps, its fairly normal practice.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi all,
I want to add a ListBox into a tab page at run time, not design time. Can someone give me a clue.
Thanks
I appreciate your help all the time...
CodingLover
|
|
|
|
|
this is something i made a few days ago...
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
RefreshList();
switch (tabControl1.SelectedIndex)
{
case 0:
tabPage1.Controls.Add(groupBox2);
tabPage1.Controls.Add(groupBox1);
break;
case 1:
tabPage2.Controls.Add(groupBox2);
tabPage2.Controls.Add(groupBox1);
break;
case 2:
tabPage3.Controls.Add(groupBox2);
tabPage3.Controls.Add(groupBox1);
break;
default:
break;
}
}
|
|
|
|
|
Mainly what I want to do is this.
In my tab control added three tabs. Initially added ListBox to the first tab. Next time, if the tab page 1 have a list box I want to add to the next tab page.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Michael gave you the answers, use selected tab to identify the page, check if the control has been added to the pages control collection if it is missing then add it to the collection. All the commands are in Michaels example, you can't expect someone to write it to match your somewhat twisted logic.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I'm not expecting any code pal. I just wonder how to find a page has a control or not. In other words, how to find something is contain in a specific tab page.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
check the tab pages control collection
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
may be this code could help you...
// use this one to find a control on you tabcontrol
tabControl1.Controls.Find("Control");
//use this one to see if there any controls on the tab page
tabControl1.Controls.Count
Or
//getting the number of tab pages...
tabControl1.TabCount
|
|
|
|
|
There is a big problem for me as I have to handle a project made by an other person and I m not aware of this code.I have two tables in SQL Server 2005 named AudioFileDetails having fields---- FileId int 4, FileName varchar 1000, Subject varchar 500, DistrictId smallint 2 and other table is DistrictDetails with the fields ------- DistrictId smallint 2, DistrictName varchar 100.I have a query form (ASP.NET) that have two fields named Subject and DistrictName, both dropdownlist box with the entries from the database .In this web form there is a button named Go to execute the query.The button is working ie records are displayed according to the value selected from the dropdownlist either from District or from the Subject or from the both.The result is shown in the grid which is given below the GO button.This grid have two fields named Subject and DistrictName and a button named Play ,on which the user can click and play the file that is displayed from the query.When the user click on the play button an another form is displayed that contains a windowsVedioMedia to play that audio file (as the files are audio files), two text boxes that displays two fields subject , DistrictName and a button Save to save the entries if user have edited.These fields contains the value of the subject and DistrictName of the file being played.But my problem is that as subject is directly taken from the AudioFileDetails table that is from the database but the DistrictName value is not coming in the District text box.The district field contains no value in the form ,but there is the entry in the database of that field. fields.Please tell me how can I get the value of District field in that table as in the database there is a field named DistrictId not DistrictName and also a coding to save the edited value also.Please give me in detail as I m not so aware of this language……..i m giving u the entire code used.......some error is there so please let me know.....
_______________________________________________________
AudioSearch.aspx.cs
Using System;
Using System.Data;
Using System.configuration;
Using System.web;
Using System.web.Security;
Using System.web.UI;
Using System.web.UI.Webcontrols;
Using System.web.UI.Webcontrols.webparts;
Using System.web.UI.HtmlControls;
Using System.Data.Sqlclient;
public partial class AudioSearch: System.web.UI .Page
{
protected void page_load(object sender,EventArgs e)
{
if(!page.IsPostBack)
{
try
{
DataSet ds1=New DataSet();
DataSet ds2=New DataSet();
AudioSearchClass objch=New AudioSearchClass();
Ds1=objch.GetTheDistrictNames();
ddlDistrictName.Datasource=ds1;
ddlDistrictName.DataTextField=”DistrictName”;
ddlDistrictName.DataValueField=”DistrictId”;
ddlDistrictName.DataBind();
ddlDistrictName.Items.Insert(0,”-Select”);
ds2=objch.GetTheSubject();
ddlSubject.Datasource=ds2;
ddlSubject.DataTextField=”Subject”;
ddlSubject.DataValueField=” Subject Id”;
ddlSubject.DataBind();
ddlSubject.Items.Insert(0,”-Select”);
String Restore=string.Empty;
Restore=Request.QueryString.Get(“Restore”);
If(Restore==”Yes”)
{
ddlSubject.SelectedItem.Text=Session[“SubjectIndex”].ToString(); ddlDistrictName.SelectedIndex=(Convert.ToInt32(Session[“DistrictIndex”] .ToString();
FillGridView();
}
}
catch(Exception ex)
{
}
}
}
protected void btnGo_Click(object sender,EventArgs e)
{
FillGridView();
}
protected void GridView1_SelectedIndexChanged(object sender,EventArgs e)
{
string FileId=(GridView1.DataKeys[GridView1.SelectedIndex][“FileId”].ToString());
string FileName= (GridView1.DataKeys[GridView1.SelectedIndex][“ FileName”].ToString());
string Subject=(GridView1.DataKeys[GridView1.SelectedIndex][“Subject”].ToString());
string DistrictName =(GridView1.DataKeys[GridView1.SelectedIndex][“DistrictName”].ToString());
Session[“FileId _S”]= FileId;
Session[“Subject _S”]= Subject;
Session[“DistrictName _S”]= DistrictName;
Session[“FilePath_S”]= FileName;
Response.Redirect(“AudioDisplay.aspx”);
}
Private void FillGridView()
{
try
{
AudioSearchClass up=New AudioSearchClass();
if(ddlDistrictName.SelectedIndex!=0)
Up.DistrictId=int.parse((string)(ddlDistrictName.SelectedValue));
if(ddlSubject.SelectedValue.Equals(“-Select-“))
Up.Subject= ddlSubject.SelectedValue;
DataSet Gridds=new DataSet();
Gridds=up.GetFilePaths();
GridView1.DataSource=Gridds.Tables[0];
GridView1.DataBind();
if(Gridds.Tables[0].Rows.Count= =0)
{
GridView1.visible=false;
lblmsg.visible=false;
lblmsg.Text=”No Recordings found for your query”;
}
else
{
Session[“SubjectIndex ”]= ddlSubject.SelectedValue;
Session[“DistrictIndex”]= ddlDistrictName.SelectedIndex;
GridView1.visible=True;
lblmsg.visible=True;
lblmsg.Text=”There are”+ Gridds.Tables[0].Rows.Count+”Recordings found for your query”;
}
}
catch(Exception ex)
{
}
}
}
_______________________________________________________
AudioDisplay.aspx.cs
public partial class AudioDisplay: System.web.UI .Page
{
protected void page_load(object sender,EventArgs e)
{
if(!page.IsPostBack)
{
if(CheckSession(“Subject_s”))
txtSubject.Text=Session[“Subject_s”].ToString();
if(CheckSession(“DistrictName_s”))
txt District.Text=Session[“DistrictName_s”].ToString();
}
try
{
if(Session[FilePath_s”]!=null)
windowsMedia1.videoURL=Session[FilePath_s”].ToString();
}
catch(Exception ex)
{
}
}
private bool CheckSession(string Name)
{
if(Session[Name]!=null)
return true;
else
return false;
}
protected void btnSave_Click(object sender,EventArg e)
{
int FileId=0;
if(CheckSession(“FileId_s”)
FileId=Convert.ToInt32(Session[“FileId_s”].ToString();
AudioDisplayClass objDis=New AudioDisplayClass();
objDis.Subject=txtSubject.Text;
objDis.DistrictName=txtDistrict.Text;
objDis.FileId=FileId;
objDis.UpdateFileDetails();
lblEMsg.Text=”Updated Successfully”;
}
_______________________________________________________
AudioDisplayClass.cs
Public Class AudioDisplayClass
{
public DataBase mDataBaseObject;
private int mFileId=0;
private int mDistrictId=0;
private string mSubject=String.Empty;
private string mDistrictName=String.Empty;
public String DistrictName
{
get {return mDistrictName;}
set{mDistrictName=value;}
}
public String Subject
{
get {return mSubject;}
set{mSubject =value;}
}
public int DistrictId
{
get {return mDistrictId;}
set{ mDistrictId =value;}
}
public AudioDisplayClass()
{
mDataBaseObject=DataBaseFactory.CreateDataBase();
}
public void UpdateFileDetails()
{
try
{
DataBase objDB=mDataBaseobject;
System.Data.Common.DBCommand =objDB.GetStoredProcCommand(“UpdateAudioFileDetails”);
objDB.AddInParameter(objCommand,”@FileId”,DBType.String,mFileId);
objDB.AddInParameter(objCommand,”@Subject.String,mSubject);
objDB.AddInParameter(objCommand,”@DistrictName.String,mDistrictName);
}
catch(Exception ex)
{
}
}
_______________________________________________________
AudioSearchClass.cs
Public Class AudioSearchClass
{
public DataBase mDataBaseObject;
private int mDistrictId=0;
private string mSubject=String.Empty;
private string mDistrictName=String.Empty;
public String DistrictName
{
get {return mDistrictName;}
set{mDistrictName =value;}
}
public String Subject
{
get {return mSubject;}
set{mSubject =value;}
}
public int DistrictId
{
get {return mDistrictId ;}
set{ mDistrictId =value;}
}
public AudioSearchClass()
{
mDataBaseObject=DataBaseFactory.CreateDataBase();
}
public Dataset GetFilePaths()
{
Dataset ds=new Dataset();
try
{
DataBase objDB=mDataBaseobject;
System.Data.Common.DBCommand objCommand=objDB.GetStoredProcCommand(“GetAudioFiles”);
objDB.AddInParameter(objCommand,”@Subject,DbType.String,mSubject);
objDB.AddInParameter(objCommand,”@DistrictId,DbType.String,mDistrictId);
ds=objDB.ExecuteDataSet(objCommand);
}
catch(Exception ex)
{
}
return ds;
}
}
_______________________________________________________
Stored Procedure:- UpdateAudioFileDetails
Create Procedure UpdateAudioFileDetails
( @FileId int,
@Subject varchar(100),
@DistrictId smallint 2
)
as
begin
update[dbo].[AudioFileDetails]
set
subject=@subject
DistrictId=@DistrictId
Where FileId=@FileId
End
Go
preeti1979
|
|
|
|
|
No one has time to read all the details and find your problem.
It would be appropriate if you just tell us your problem in brief.
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
Hey Guys
a few days ago i made a custom control that uses GDI+.
after playing this control on the screen for 4 hours+ the cpu is getting 50% more Work
and Memory Keep Leaking ... after that the text is moving very slow and so on...
Here is my code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using ScreenerViewer.BL.NewsBar;
namespace ScreenerViewer
{
public partial class NewsBar : Control
{
Timer t = new Timer();
int Position;
StringWriter SdisplayNormalMode = null;
StringWriter SdisplayFlickerMode = null;
string sSeparatesign = " * ";
bool bRestPosition = false;
Brush Backroundbrush = Brushes.Red;
Brush BackroundFlickBrush = Brushes.Yellow;
Brush FontFlickerBrush =Brushes.Red;
int iColorChange = 0;
bool bFirstRun = false;
Font TextFont = new Font(new FontFamily("arial"), 60);
PointF TextPoint = new PointF();
private bool _bFilckerMode;
public bool bFilckerMode
{
get { return _bFilckerMode; }
set { _bFilckerMode = value; }
}
public NewsBar()
{
InitializeComponent();
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.ResizeRedraw, true);
SdisplayNormalMode = new StringWriter();
t.Interval = 10;
t.Enabled = true;
t.Tick += new EventHandler(t_Tick);
Position = 0;
bFirstRun = true;
}
void t_Tick(object sender, EventArgs e)
{
Position+=2;
Invalidate();
}
protected override void OnPaint(PaintEventArgs pe)
{
if (!this.bFilckerMode)
{
pe.Graphics.FillRectangle(Backroundbrush,0,0,this.ClientSize.Width,ClientSize.Height);
SizeF stringSize = pe.Graphics.MeasureString(SdisplayNormalMode.ToString(),TextFont);
if (Position > ClientSize.Width)
{
Position =Convert.ToInt32( -1 * stringSize.Width);
}
if (Position == 0 && bFirstRun)
{
Position = Convert.ToInt32(-1 * stringSize.Width);
}
TextPoint.X = Position;
TextPoint.Y = 0;
pe.Graphics.DrawString(SdisplayNormalMode.ToString(), TextFont, Brushes.White, TextPoint);
}
else
{
if (iColorChange==20)
{
if (BackroundFlickBrush == Brushes.Yellow)
{
BackroundFlickBrush = Brushes.Red;
FontFlickerBrush = Brushes.Yellow;
}
else
{
BackroundFlickBrush = Brushes.Yellow;
FontFlickerBrush = Brushes.Red;
}
iColorChange = 0;
}
iColorChange++;
pe.Graphics.FillRectangle(BackroundFlickBrush, 0, 0, this.ClientSize.Width, ClientSize.Height);
SizeF stringSize = pe.Graphics.MeasureString(SdisplayFlickerMode.ToString(), TextFont);
if (Position == 0&&bFirstRun)
{
Position = Convert.ToInt32(-1 * stringSize.Width);
}
if (Position > ClientSize.Width)
{
Position = Convert.ToInt32(-1 * stringSize.Width);
bFilckerMode = false;
}
if (bRestPosition)
{
Position = Convert.ToInt32(-1 * stringSize.Width);
}
bRestPosition = false;
pe.Graphics.DrawString(SdisplayFlickerMode.ToString(), TextFont, FontFlickerBrush, TextPoint);
if (!bFilckerMode)
{
SdisplayFlickerMode = null;
}
}
bFirstRun = true;
base.OnPaint(pe);
}
public void DisplayListNormalMode(string[] Smsgdisplay)
{
if (Smsgdisplay.Length > 0)
{
foreach (string msg in Smsgdisplay)
{
SdisplayNormalMode.Write(msg + sSeparatesign);
}
}
}
public void DisplayListFlickerMode(BL.NewsBar.Flickeritem[] SFdisplay)
{
SdisplayFlickerMode = new StringWriter();
this.bFilckerMode = true;
bRestPosition = true;
string[] SoundFiles=null;
if (SFdisplay.Length > 0 )
{
SoundFiles= new string[SFdisplay.Length];
int index=0;
foreach (Flickeritem msg in SFdisplay)
{
SdisplayFlickerMode.Write(msg.Msg + sSeparatesign);
SoundFiles[index]=msg.SoundPath;
index++;
}
}
PlaySound sound = new PlaySound(SoundFiles);
sound.PlayMyList();
}
}
}
|
|
|
|
|
michael@cohen wrote: after playing this control on the screen for 4 hours+ the cpu is getting 50% more Work
and Memory Keep Leaking ... after that the text is moving very slow and so on...
michael@cohen wrote: t.Interval = 10;
Do the math. 100 repaints a second! 15 frames a second will be more than enough.
|
|
|
|
|
I can't beleive you rabbited through all that code or did the interval issues jump out!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: did the interval issues jump out!
Mostly, did do a quick scan to see if he was wasting resources, but that was not the case.
|
|
|
|
|
thanx for checking the code.
ill try to do as you say...
|
|
|
|
|
I have created a widows service,register it and it is working fine.
Now i have created Windows application.RIght Click the solution and click add new item.I have added windows service compiled code and register using "installutil C:\mcWebService\bin\Debug\windowsapplication1.exe"
Now when i go to computer->manage->services and start service it gives following error
"Error: 1053 the service did not respond to the start or control request in timly fashion"
any body has solution for this
PIEBALDconsult answered me on this forum that installutil is for windows services not for windows application.Thanks for this reply but i want to know that in windows application when we right click on project and click on "Add new item".FRom here we can add windows service class .Now my question is how this added windows service class can be installed and run?
|
|
|
|
|
idreesbadshah wrote: windows service class can be installed and run
This is done using installutil. You cannot mix a windows application and a windows service in a single install.
Check out BOL for deployment, or Google for deploying .net applcations.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks for your Replly
Just tell me one thing more.If we cannot mix windows apllication and windows services then why .net allow us in windows application to right click project and add windows service class.WHats it use there ifwe donot mix them.
|
|
|
|
|
idreesbadshah wrote: why .net allow us in windows application to right click project and add windows service class.WHats it use there ifwe donot mix them.
I assume Microsoft expected people to have a little understanding of the about what they are doing. You can do all sorts of things in programming, just like life, and just because you CAN do something it doen't mean you SHOULD do it - you can put your fingers in a chainsaw, it doesn't mean to say you should.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hello everyone,
My C# application is built for "Any CPU" option using .Net framework 2.0 using Visual Studio 2008, and I run it on a machine which is Winsows Server 2003, x64. I installed,
- .Net Framework 32-bit version 2, 3, and 3.5;
- .Net Framework 64-bit version 2, 3, and 3.5.
My question is, when run the application on the specific machine, which version of .Net Framework will be used? And why (what is the rule to choose)?
thanks in advance,
George
|
|
|
|
|
The framework depends on the OS that is on the server.So if there is X64 OS then framework would be 64 bit and same will be used by the application
Cheers!!
Brij
|
|
|
|
|
|
I believe 64 bit framework will be used if you are on a 64 bit machine. I am not sure though.
|
|
|
|