|
hi
please help me.....
am doing a mantanence project. i have writen some code to copy a file from server to harddisk. but there is some problem. i have developed this as windows application. now they want as web. tyhe problem is, i was reading the file path and copying in dos.in windos the path is already is there in html page in javascript. can i move the value to a the code behind string(C#). if we can convert how is it possible?
in code behind there is string Customer, book
on html page there is values of customer1 and journal as
var customer1 ='<%=Session["customer"]%>';<br />
var journal = '<%=Session["journal"]%>';
how can we get the values of customer1 and journal to Customer, book
please help me....
please
|
|
|
|
|
If you read the values in javascript from the Session object...why don't you read on the server (code behind) from the Session object also?
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
This is a mainanance project.
am biginer to .net
so dont know much. i dont know how to do that. thats y am asking. i just want to know how we can get the value of javascript variable in c#
This is the function in javascript
function display()
{
var localpath1 = document.getElementById('lblerr');
lblerr.innerText = localpath;
}
|
|
|
|
|
from the javascript function i understand that you have an asp:Label control on your page. In this case in the code behind just use:
string Value = lblerr.Text;
My first reply referd at this code you wrote:
<br />
var customer1 ='<%=Session["customer"]%>';<br />
var journal = '<%=Session["journal"]%>';<br />
Using <%=Session["customer"]%> means that you insert a C# call to retrieve data from the Session object, which is also available in the code behind.
string customerValue = (string)Session["customer"];
Hope it helps.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
there are ListBox,textBox to combine
baseControl is control
how to do?
alex
xufei@wxhx.com
|
|
|
|
|
ComboBox cb = new ComboBox();
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
how to check database if exist on the server using c#?
thanks in advance,
******************************
I just want to
know everything
|
|
|
|
|
use microsoft sqlserver connection info dll files
private static Server srvSql;
private static ServerConnection srvConn;
void ReadDatabase(string _ServerName)
{
try
{
srvConn = new ServerConnection(_ServerName);
srvConn.LoginSecure = true;
srvSql = new Server(srvConn);
foreach (Database MyServer in srvSql.Databases)
{
cmboDB.Items.Add(MyServer.Name);
//Here you can check wheather database exist or not
}
}
catch (Exception DbExp)
{
MessageBox.Show("Error in Connection !!!!", "Database ", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
|
|
|
|
|
Take One Textbox anb Button........
Write the following code for Button click....
SqlConnection cn = new SqlConnection("server=ms08; uid=sa; pwd=;");
string Qry ="SELECT Count(*) FROM master.dbo.sysdatabases WHERE name = '" + TextBox1.Text + "'";
SqlDataAdapter da = new SqlDataAdapter(Qry,cn);
DataSet ds =new DataSet();
da.Fill(ds);
DataRow dr=ds.Tables[0].Rows[0];
if(dr[0].ToString() == "1")
MessageBox.Show(Exists..")
else
MessageBox.Show("Does not exists....");
venki
|
|
|
|
|
Try to connect to the database and catch any exceptions that it may throw back at you about not being able to connect to the specified database.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
to Abhijit Jana , Venki56 and Paul Conrad
Thanks for your help,
Cheers.
******************************
I just want to
know everything
|
|
|
|
|
Hi Friends,
I got a strange question on my application. Sometimes when I going to start my application, a installer will appear, and asking for reinsall. After reinstalled, the application can be run.
It was not happened everytimes, but very occasionally. I'm thinking what's wrong in my project design?
1. will it related to the problem of some missing folder? (coz I set all folder AlwaysCreate to true)
2. any wrong step I made on my installer?
My project is related to PDF, is it related to PDF problem?
Please help, and give some hints. Thanks so much
|
|
|
|
|
Hi!
I guess you've created a setup and deployment project to install your application and are starting the program using a shortcut created there, right?
In this case, Windows Installer checks if all the key files in your installation are still there and if not tries to reinstall them.
I can't describe it in all details but this should get you started.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi, I was woundering if some of the higher level C# programmers could help me with my code. I have read all the Doc. that i can find about it, But i still cant get it to fully work. If I comment out the keyboadx ref's the mouseclickx works fine. If I dont neather the mouseclickx nor the keyboardx works at all. I cant get the keyboardx to work in any fashion.
I made a link to a paste it site because i didnt know how it it is looked at about paste long code in forums.
http://rafb.net/p/bmuAVm81.html[^]
|
|
|
|
|
Hi,
the problem is with your INPUT struct; its original C definition has a union which
puts MOUSEINPUT and KEYBDINPUT at the same location; yours has not, so the substructs
are located sequentially.
There is a way to mimic union behavior in C# using explicit offsets, but in this case
it would be easier to come up with two different INPUT structs (say INPUTK and INPUTM),
and two prototypes for SendInput accordingly.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
And as usual, Luc has the answer.
I wouldn't even have thought of checking the original structs.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
when it fails no part is beyond suspicion...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Thank you for the reply. I have modifed my code serveral time to try to make the struct more like you said. but to no avail can i get it to work. this is the code I have this time.
Let me know what you see wrong on this one..
Thank you very much
Danzar
http://rafb.net/p/uPx4EW73.html[^]
|
|
|
|
|
Hi danzar,
the way I read the documentation on KEYBDINPUT structure, you must specify a valid
dwExtraInfo
"Specifies an additional value associated with the keystroke. Use the GetMessageExtraInfo function to obtain this information"
so I think your zero value is not good enough.
BTW: I noticed the mouse struct is smaller than the keyboard struct, but the original INPUT
has a union, so its size must accomodate the largest of them (once you try my INPUTM, it
would fail if you don't take care of that!).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I want to be able to create generic event procedures that can be used for a number of controls (the same type) on a form.
For example (assume the object sender would always be a text box);
private void tbCallBlockPct_Click(object sender, EventArgs e)<br />
{<br />
sender.SelectAll();<br />
}
However when I try somehting like this I get a syntax error that the “object sender does not contain a definition for SelectAll”.
If the function is being passed a textbox as the variable sender should not all of its methods and properties be accessable?
David Wilkes
|
|
|
|
|
sender is of type object , which doesn't have a SelectAll() method in its interface. You should cast sender to an object variable of type TextBox in order to invoke properties/methods particular to this class.
TextBox tb = (TextBox)sender;
tb.SelectAll();
Paul Marfleet
|
|
|
|
|
Thanks.
That is alomost exactly what I ended comming up with not too long after posting the message. It seemed a bit round about and redundant, so i was not sure about it.
Would it be correct to assume that since the tb.SelectAll works (selects the text in the original control) means that the tb is a pointer to the actual text box and not a copy of it?
It would seem that you should be able to do it more directly, like (TextBox)sender.SelectAll(); or something similar.
David Wilkes
|
|
|
|
|
amatbrewer wrote: Would it be correct to assume that since the tb.SelectAll works (selects the text in the original control) means that the tb is a pointer to the actual text box and not a copy of it?
Yes.
amatbrewer wrote: It would seem that you should be able to do it more directly, like (TextBox)sender.SelectAll(); or something similar.
Try this one: ((TextBox) sender).SelectAll();
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
It would be safer not to assume that the sender is a TextBox (one day it won't be). Code like this:
TextBox tb = sender as TextBox;
if (tb != null)
{
tb.SelectAll();
}
else
{
}
Phil
The opinions expressed in this post are not necessarily those of the author, especially if you find them impolite, inaccurate or inflammatory.
|
|
|
|
|
hy everyone!
i do already have an idea for this but i thought, maybe there is a better solution than mine (easier, more stable etc.) so that's why i ask:
i do have datafields with one line containing the fielddescription and the second line containing the values. now i do want to store these info so i am able to use it later on.
my idea would be to store it in arrays, one for every dataset. one array field is the fielddescription (FD) and the second one is the value to this description field (VF).
so it would look like this
---------------------------
| 1 | 2 | ....
.....................
|FD1 |VF1 |FD1 |VF1 |
.....................
|FD2 |VF2 |FD2 |VF2 |
.....................
|... |... ||... |... |
......................
|FDn |VFn ||FDn |VFn |
......................
i chose this way because i do want to allow reordering of the "fields" (e.g. datafield11 and datafield22 change places) or there is a new field append to the old ones (lets say a n+1 field).
what way would you define this structure (i would define a two dimensional array, where the second array contains another two dimensional array)?
or do you have a better idea of how to store this info in a datastructure?
the infos in my txtfile i do parse look like this (this are two pairs of info!)
name1, name2, name3, name4, ...
value1, value2, valure3, value4, ...
name1, name2, name3, name4, ...
value1, value2, valure3, value4, ...
where the first pair is the first element in my arraystructure, the second one is the second arrayelement etc.
i do know how many lines they are. because of the structure i am able to count how many pairs are available. so i know the dimension of the datastructure which i do have to provide (with dynamic arrays this is quit easy to do).
but from my point of view my structure looks a little strange, because if you want to access the first value of the first element then you have to do the following
access the first dataelement in the array and then enter the second array to get the required data.
eg.
datalement[1,[2]]
(not correct coded i guess, but you might get the meaning of it.
so my question is: how would you define a datastructure to store the info
name1, name2, name3, name4, ...<br />
value 1, value 2, valure3, value4, ...<br />
name 1, name2, name3, name4, ...<br />
value 1, value2, valure3, value4, ...<br />
....<br />
name1, name2, name3, name4, ...<br />
value1, value2, valure3, value4, ...<br />
name1, name2, name3, name4, ...<br />
value1, value2, valure3, value4, ...<br />
so any idea how to store this info in a more simpley way is welcome.
thanks!
stephan.
|
|
|
|
|