|
|
|
Thank you, i'll have a look at both!
|
|
|
|
|
Hi
Could someone plz help me.
I need to edit a particular tabpage's labels. my tabpages are sitting in an array called allTabs[].
When i click a certain button it should adjust a label on the currently selected tabpage. Im sure i could match the index in my allTabs[] with the index of selected tabPage. Only thing is, how do i get the index of selected tabPage?
|
|
|
|
|
rcwoods wrote: Only thing is, how do i get the index of selected tabPage?
I think you need this!
void tabControl1_Selected(object sender, TabControlEventArgs e)<br />
{<br />
MessageBox(e.TabPageIndex.toString());<br />
e.TabPage.Text = "current page";
}
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
{
EnvDTE.DTE dteInst80 = (EnvDTE.DTE)Microsoft.VisualBasic.Interaction.CreateObject("VisualStudio.DTE.8.0", "");
//object dte = Microsoft.VisualBasic.Interaction.CreateObject("VisualStudio.DTE.8.0", "");
dteInst80.SuppressUI = false;
if (dteInst80 != null)
{
dteInst80.ItemOperations.OpenFile(txtPath.Text, EnvDTE.Constants.vsViewKindTextView );
I execute this and on the last line it errors with "Value does not fall within the expected range."
But, the documentation says that vsViewKindTextView is one of the arguments.
DOes anyone know what I am doing wrong?
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
I have an app that is used on a lot of pocketpc devices. While the app is still in beta, I have written a Trace function to write to a file, and it uses DateTime.Now to log the time. On most of the devices it's on it works correctly. However, on a few of them, it wrote this out a few minutes ago:
4/12/2006 1:30:00 PM
when it should've been this:
6/9/2006 4:25:00 PM
We've checked and verified that the devices have the correct date and time set, and the file where it's logging this wasn't even created back in April (let alone the Trace function I wrote). Does anyone have any idea why it would be doing this?
My Music | My Pics | My Articles
BlackDice
|
|
|
|
|
i am working on a project where read a sql statement from a file and then modify it and pass it to sql server 2000 via a sqlconnection. one of the files has 2 functions and each function declares 2 of the same variables. in the sql file they use a / to break them into 2 seperate statements, but when i pass the / through my app i get an error. if i leave it off it gives me the error that the 2 varibles already exists. can someone tell me how to make this work?
|
|
|
|
|
ddpn42 wrote: when i pass the / through my app i get an error. if i leave it off it gives me the error that the 2 varibles already exists. can someone tell me how to make this work?
What is the error message? What do the broken apart strings look like? How would you account for a situation like this?
SELECT RecommendedPrice / DiscountPercent As DiscountAmount FROM Products
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
the / is after the end like this
END
/
when i try to pass it through the app i get a syntax error. i can post the same sql with the / in query analyzer and it works fine. what i don't understand is why does it work with query analyzer but not when i pass it through my app.
|
|
|
|
|
If it's your SQL file, why not remove the duplicate declarations? By function I'm assuming you mean statement. You can seperate statements with 'GO ' (in MS SQL Server at least) and I believe a semicolon ('; '). But the variable declarations will remain in context for both statements, you don't need to duplicate declaration. And even if you did, you could use different variable names.
declare @one int
declare @two int
select @one = 1
GO -- Really unnecessary in this example
select @two = 2
Visit BoneSoft.com
|
|
|
|
|
i do not manage the sql scripts and they are not delivered with my app. so if i change them it will have to be in my app and i am trying to not do that. i am not sure what / does exactly but it makes the statements work in query analyzer. Just does not make sense to me.
|
|
|
|
|
BoneSoft wrote: You can seperate statements with 'GO' (in MS SQL Server at least)
The GO is not actually part of T-SQL (the dialect of SQL used in SQL Server). It is a preprocessing symbol used by query analyser to split batches of SQL. Query Analyzer will strip out the GO symbols and send the chunks of SQL they deliniate to SQL Server individually. The variable declarations will not remain in context between GO symbols. The code example you have given will produce an error because after the GO the variable @two is no longer recognised. Also, I'm not sure what the @removed is for. Query Analyzer produces the following:
Server: Msg 137, Level 15, State 1, Line 3
Must declare the variable '@removed'.
Server: Msg 137, Level 15, State 1, Line 1
Must declare the variable '@two'. I also had to delete the comment as the GO is the only thing permitted on the line on which it appears.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
I had forgotten that about 'GO', and '@removed' was supposed to be '@one', I have NO IDEA what I was thinking there...
Visit BoneSoft.com
|
|
|
|
|
Hello,
How do I determine which Tree node has been right-clicked by the user? I can't use the Selected property because right-clicking does not select the new node.
Also, is there a way to tell the TreeView to display the Plus/Minus symbol next to a node even if it does not have any child nodes? I need to do that because I dynamically populate the tree.
Thanks
|
|
|
|
|
private void treeView1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) {
Point pt = treeView1.PointToClient(new Point(e.X, e.Y));
TreeNode DestinationNode = treeView1.GetNodeAt(pt);
}
Visit BoneSoft.com
|
|
|
|
|
Thank you so much, Mr. BoneSoft!
|
|
|
|
|
|
I know how to add a new line in streams, but how can I delete all the lines?
|
|
|
|
|
Basically you can't you have to create a new stream, write everything up to the lines you want to delete, forward over the lines to delete and write the rest of the file.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
huuhh??? there is no way to delete everything in that file and then add stuff i want?
|
|
|
|
|
There is but not in the way you asked, you implied that you wanted to delete specific lines.
If you want to overwrite the file then you can create the stream using:
FileStream baseStream = new FileStream("path", FileMode.CreateNew); Which will overwrite the file, you can then use this stream as the basis for higher-level streams such as the TextWriter.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
hellow to all i am trying to bind combobox , and to put in it data from database ,
i had write the following code ,
try
{
string sConnection = @"provider=microsoft.jet.oledb.4.0;data source=C:\BIG_Project.mdb";
System.Data.OleDb.OleDbConnection OleDbConn = new System.Data.OleDb.OleDbConnection(sConnection);
System.Data.DataSet ds1 = new System.Data.DataSet("tbl_Users_Catagory") ;
string OleDBUserCatagory = "SELECT * FROM tbl_Users_Catagory";
System.Data.OleDb.OleDbDataAdapter OleDBAdptrUserCatagory = new System.Data.OleDb.OleDbDataAdapter(OleDBUserCatagory,OleDbConn);
OleDBAdptrUserCatagory.FillSchema(ds1,System.Data.SchemaType.Source,"tbl_Users_Catagory");
OleDBAdptrUserCatagory.Fill(ds1,"tbl_Users_Catagory");
cmb_Catagory.DataSource = ds1;
cmb_Catagory.DisplayMember = "Catagory_Name";
cmb_Catagory.ValueMember = "Catagory_Num";
cmb_Catagory.SelectedIndex = -1;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
i recive this message , could not bind to the new display member
thxx for anyhelp ,
|
|
|
|
|
Um, you might have done this, but check the spelling on the 'Catagory_Num' column. (By the way, the correct spelling is 'Category'.
|
|
|
|
|
Hi guys!
I am a newbie in C# and I need your help. I have a main menu form and an add form, when I click on the add form on the main menu, I am first calling checkfile() function to see if a .ini file exists, if it does then it is supposed to continue opening the add form and if the file doesn't exist then I want it to do nothing, not open the add form but instead stay on Main form. Please see the code below, I have put in CAPS what I want to do. If there is any other trick then please suggest. Thank you guys in advance. PS. Main form always stays open even when add form is open
public int CheckFile()
{
string NameOfFile = "C:\\CB\\Config.ini";
FileInfo cmdNew = new FileInfo(NameOfFile);
if(cmdNew.Exists == false)
{
DialogResult Result;
Result=MessageBox.Show(this, "Please Create New Setup to
Continue?", "SelecSoftware CB",
MessageBoxButtons.YesNo, MessageBoxIcon.Error);
if(Result==DialogResult.Yes)
{
//HERE I WANT TO DO NOTHING, CANCEL THE CLICK EVENT AND STAY ON MAIN MENU
}
}
}
//Here is the click event
private void cmdAdd_Click(object sender, System.EventArgs e)
//This function uses an object to open the Add Dealer code form
{
//When clicked I call the checkfile function
CheckFile();
AddDC frmAddDC = new AddDC();
frmAddDC.cmdDelete.Visible=false;
frmAddDC.cmdSave.Location=new System.Drawing.Point(83, 624);
frmAddDC.cmdExit.Location=new System.Drawing.Point(211, 624);
frmAddDC.ShowDialog();
}
sasa
|
|
|
|