|
You have been posting this (and similar) questions every few hours for the past few days, you have not recieved any meaningful replies - does this not tell you anything?
Here, let me give you some pointers.
1) It is understood that English may not be your first language, but if you understand it well enough to abbreviate almost every word then surely you can make an attempt to write the word in full. Dont worry about the odd spelling mistake as Im sure most people can work around them - but having to decipher txt-spk is just a pain in the butt.
2) Asking for fully written code just is not going happen, you must attempt these things yourself using articles/books/documentation, and when you hit a specific proplem then come and ask about that problem. Dont expect somebody to do this for you for free.
3) Please do not ask for answers to be mailed directly to you, this board and every other technical forum, is there for everybody to learn from.
|
|
|
|
|
Hi,
You can connect to the database and do all these operations using Connection, Command, DataReader, DataAdapter classes.
SqlConnection conn = new SqlConnection();
conn. ConnectionString = ""; //Set the connection parameters
SqlCommand cmd = new SqlCommand("");//pass SQl query
conn.Open(); // Open the connection
cmd.Connection = conn;
SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);//execute the command
Read MSDN for more help.
Thanks
SGS
|
|
|
|
|
hi
How i can get a size of RAM and a speed of prossesor by C++ (borland) ?
|
|
|
|
|
|
Hi Guys,
I get the handle of my "windows service" by using
<br />
System.Diagnostics.Process proc = Process.GetCurrentProcess();<br />
log.WriteEntry(proc.Handle);<br />
I install a WH_CALLWNDPROC hook to capture any windows messages that my "windows service" might receive.
If use Sendmessage(proc.Handle,0x0308,IntPtr.Zero,IntPtr.Zero); to send a message to my service, the hook doesn't pick it up.
Does anyone know why this wouldn't work ????
|
|
|
|
|
Hi!.
SendMessage is sending messages to windows using their window handle.
You're fetching the process handle of your process.
These are two completely different things.
A process doesn't have to have one or more windows associated with it, so you can't just exchange different handles.
Regards,
mav
|
|
|
|
|
Thanks for the info.
So is there any way that i can send a windows message to a windows service.
|
|
|
|
|
Only if your service creates a window that windows messages can be sent to.
Usually a service isn't allowed to perform desktop operations, so creating a window from a service for communication isn't usually the best way.
I think you should consider a different way of IPC, depending on what you want to do.
Regards,
mav
|
|
|
|
|
The right solution for your problem will be some IPC(Inter Process Communication) methods. Preferably you could try Named Pipes. Try CreatePipe and stuff like that.
James
|
|
|
|
|
Hi,
I posted a thread yesterday about creating and printing documents with a template and text out of the database.
I was able to import an Office Object and to work with it. Setting the contents and I automatically get a 'save to' box.
Now I'm trying to use the open and printout function and here comes the problem: the required parameters are all of type ref object . When I create those objects and execute the function I get a 'Type Mismatch' error. Probably because the function tries to cast the objects to a certain type.
Does anyone know what the types are the function needs? Which parameters can be null? I found an example on MSDN, but, off course, this was VB and the function didn't have half as much parameters.
Here a sample of my code. (note, I don't know anything about automation and the object model, so I'm totally fishing here)
I need this for a demo, so nothing fancy is needed:
Get the data out of the database and print it (according to the correct template and with a number of copies).
<br />
foreach(DataRow row in ds.Tables[0].Rows){<br />
while(File.Exists(path + "file" + index + ".rtf")){<br />
index++;<br />
}
object ob1 = row["templatename"], ob2 = 0, ob3 = 0;<br />
object ob4 = 0, ob5 = "", ob6 = "";<br />
object ob7 = 0, ob8 = 0, ob9 = 0;<br />
object ob10 = "", ob11 = "", ob12 = 1;<br />
object ob13 = 0, ob14 = 0, ob15 = 0;<br />
object ob16 = 0;<br />
try{<br />
doc.Application.Documents.Open(ref ob1, ref ob2, ref ob3, ref ob4, ref ob5, ref ob6, ref ob7, ref ob8, ref ob9, ref ob10, ref ob11, ref ob12, ref ob13, ref ob14, ref ob15, ref ob16);<br />
}<br />
catch(Exception ex1){<br />
MessageBox.Show("Open error:\n\n" + ex1);<br />
}<br />
doc.Content.Text = row["contents"] + "";<br />
doc.Save();<br />
index++;<br />
}
object o1 = 0, o2 = 0, o3 = 0;<br />
object o4 = "", o5 = 1, o6 = 1;<br />
object o7 = 0, o8 = --index, o9 = 1;<br />
object o10 = 1, o11 = 0, o12 = 0;<br />
object o13 = 0, o14 = 0, o15 = 0;<br />
object o16 = 0, o17 = 0, o18 = 0;<br />
try{<br />
doc.PrintOut( ref o1, ref o2, ref o3, ref o4, ref o5, ref o6, ref o7, ref o8, ref o9, ref o10, ref o11, ref o12, ref o13, ref o14, ref o15, ref o16, ref o17, ref o18);<br />
}<br />
catch(Exception ex2){<br />
MessageBox.Show("PrintOut error:\n\n" + ex2);<br />
}<br />
<br />
object obj1 = false;<br />
object obj2 = null;<br />
object obj3 = null;<br />
doc.Application.Quit(ref obj1, ref obj2, ref obj3);<br />
I hope somebody can help me.
tnx.
(PS: somebody pointed me out to Crystal Reports, but I don't know that either )
No hurries, no worries.
|
|
|
|
|
I came across this article http://www.codeproject.com/csharp/ShellID3TagReader.asp[^] and so I tried doing exactly as shown but it's not working. When the folder.GetDetailsOf function returns it's blank but I know for a fact that there this mp3 has an ID3 tag. Furthermore when I add the extra columns in Windows Explorer to see the mp3 info it doesn't display anything. Can my Shell32 be broken somehow? Here's the code I have (even though it's the same in the article):
MP3File mp3File = new MP3File();<br />
string fileName = FilePath.Substring(FilePath.LastIndexOf("\\") + 1);<br />
string filePath = FilePath.Substring(0, FilePath.LastIndexOf("\\"));<br />
<br />
Shell32.Shell shell = new Shell32.ShellClass();<br />
Shell32.Folder folder = shell.NameSpace(filePath);<br />
Shell32.FolderItem folderItem = folder.ParseName(fileName);<br />
<br />
if(folderItem != null)<br />
{<br />
mp3File.FileName = fileName;<br />
mp3File.AlbumName = folder.GetDetailsOf(folderItem, 17);<br />
mp3File.ArtistName = folder.GetDetailsOf(folderItem, 16);<br />
mp3File.SongTitle = folder.GetDetailsOf(folderItem, 10);<br />
mp3File.TrackNumber = folder.GetDetailsOf(folderItem, 19);<br />
}<br />
<br />
folderItem = null;<br />
folder = null;<br />
shell = null;<br />
<br />
return mp3File;
I'm using XPpro SP2.
Please Help,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
Can somebody comment this code? ı got this from somewhere but İ couldnt understand why used (-1)?Whats the trick??
<br />
<br />
if (Int32.Parse(myDataSet.Tables[0].Rows[Int32.Parse(((TextBox)myItem.FindControl("textCriteriaNumber")).Text) - 1]["CRITERIA_VALUE"].ToString())==1)<br />
<br />
((CheckBox)myItem.FindControl("cbCriteriaValue1")).Checked = true;<br />
<br />
|
|
|
|
|
Obviously, the TextBox used for Input contains "normal" counting, e.g. 1 is the first element, 2 is the second element and so on. (1-based)
Arrays in C# have 0 as the first element, 1 as the second etc. (0-based)
So, in order to allow people to enter "1" for the first element, you need to substract 1 in order to get the Index of the corresponding item in the array.
Cheers
Sid
|
|
|
|
|
|
The problem here is that there are many things going on all in one line, making it hard to read if you're not all that C# savvy.
Maybe splitting it up could help you.
TextBox criteriaNumberTextBox = (TextBox)myItem.FindControl("textCriteriaNumber");
int criteriaNumber = int.Parse(criteriaNumberTextBox .Text);
DataTable firstTable = myDataSet.Tables[0];
DataRow rowBeforeCriteriaNumber = firstTable.Rows[criteriaNumber-1];
int criteriaValue = int.Parse(rowBeforeCriteriaNumber["CRITERIA_VALUE"].ToString());
if(criteriaValue == 1)
{
CheckBox criteriaValue1 = (CheckBox)myItem.FindControl("cbCriteriaValue1");
criteriaValue1.Checked = true;
}
* disclaimer - the above was typed quickly, I cant guarantee it is compilable in place of the code you pasted.
Im sorry I cant really help you on why this code uses the -1, it seems a bit weird. This is often used to get the last item in an array - as they are zero based the arraylist.count-1 is the last item in the arraylist. However this doesnt appear to be the case with the above code - unless textCriteriaNumber holds the count of an arraylist.
Anyway, maybe commenting the code helps you understand it better.
|
|
|
|
|
I want to check one of my checkboxes in datagrid..but when i check one of them, i got a javascript error at the bottom of my page...Is there something wrong with my code??Can you see??
<br />
private void adjustQuestionsGrid(int centerId)<br />
{<br />
coreMarseg.clinicalTrials mySurvey = new coreMarseg.clinicalTrials();<br />
DataSet myDataSet = mySurvey.getSurveyDetail(centerId);<br />
<br />
DataGridItem myItem;<br />
<br />
for(int i=0;i < myDataGrid.Items.Count; i++)<br />
{<br />
myItem = myDataGrid.Items[i];<br />
if ((myItem.ItemType != ListItemType.Header) &&<br />
(myItem.ItemType != ListItemType.Footer) &&<br />
(myItem.ItemType != ListItemType.Separator)) <br />
{<br />
((CheckBox)myItem.FindControl("cbQuestionValue0")).Checked = false;<br />
((CheckBox)myItem.FindControl("cbQuestionValue1")).Checked = false;<br />
<br />
<br />
if (Int32.Parse(myDataSet.Tables[0].Rows[Int32.Parse(((TextBox)myItem.FindControl("textQuestionId")).Text) - 1]["SD_QUESTION_VALUE"].ToString())==0)<br />
((CheckBox)myItem.FindControl("cbQuestionValue0")).Checked = true;<br />
<br />
if (Int32.Parse(myDataSet.Tables[0].Rows[Int32.Parse(((TextBox)myItem.FindControl("textQuestionId")).Text) - 1]["SD_QUESTION_VALUE"].ToString())==1)<br />
((CheckBox)myItem.FindControl("cbQuestionValue1")).Checked = true;<br />
<br />
}<br />
}<br />
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
private void myDataGrid_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)<br />
{<br />
CheckBox myCheckBox;<br />
<br />
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))<br />
{<br />
myCheckBox = (CheckBox)e.Item.FindControl("cbQuestionValue0");<br />
myCheckBox.Attributes.Add("OnClick", "adjustQuestionsGridRow(this);");<br />
<br />
myCheckBox = (CheckBox)e.Item.FindControl("cbQuestionValue1");<br />
myCheckBox.Attributes.Add("OnClick", "adjustQuestionsGridRow(this);"); <br />
}<br />
}<br />
<br />
function adjustQuestionsGridRow(cb) {
cb.parentElement.parentElement.children.item(1).children.item(0).checked = false;
cb.parentElement.parentElement.children.item(2).children.item(0).checked = false;
cb.checked = true;
}
|
|
|
|
|
Can someone help my question??
|
|
|
|
|
Assum that I have a form1 with a tab control.
In form1, I have variables, some ArrayList for example.
ArrayList arr1
ArrayList arr2
....
These ArrayList contain names of properties (key) and values of these
properties (int value)
Now I would like to create a template that is a Tab Page which
contains:
- A combo box displays name of elements of selected ArrayList of form1
- A textbox that display value of any element that I selected from the
combo box
Each time I change the value in the textbox, the value in appropriate
ArrayList will change.
Afterall, I can create a new instance and add this template-Tab Page to
the tab control of form1.
In fact, this tag page can be delete whenever I select another array
list (at runtime, I may choose it from a combo box contained in form1)
That all I need to learn. Please help me how to do this.
Thankx
|
|
|
|
|
I have an application in which when i open the MDI Child for in maximised state the button controls at the bottom of the form are not visible. They are hidden behind the status bar.
Once i resize the child form and maximize it again i can see the butons.
Can any one help with this kind of a problem
|
|
|
|
|
try aligning the button edges to the borders .... I had that kinda of issue but I got around by trial and error
Pushkar Pathak
|
|
|
|
|
I'm having problems trying to accomplish a certain task. I want to save some custom information about an image and then save the image itself in the same file. I can write and read my infomation by itself using a binary writer/reader but as soon as I try to throw a System.Drawing.Image in the mix things get messed up. Am I going about using the image correctly like this:
...<br />
System.IO.FileStream iStream = new System.IO.FileStream(FileName, System.IO.FileMode.Append, System.IO.FileAccess.Write);<br />
Image.Save(iStream, System.Drawing.Imaging.ImageFormat.Png);<br />
...
It seems to me that as soon as I do the above code the filestream gets all weird and I it's no longer in a readable format.
Please help,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
Rob Tomson wrote:
System.IO.FileStream iStream = new System.IO.FileStream(FileName, System.IO.FileMode.Append, System.IO.FileAccess.Write);
Why do you Append? Try Create or Truncate.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
I was doing Append because the code before this writes my custom information that I want before the actual image. If I just do Create then it would overwrite all the info I just wrote. I've also tried just writing my stuff then writing the image through one FileStream but I get the same effect of not being able to read the file afterwards.
Thanks,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
You cant do that, it break the file format. Alternatively, it you wanna encapsulate the image files, you can embed them in the Stream, but you will have to setup (preferably another) Stream to supply only the correct offsets for Image.FromStream() to work.
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
How would I go about doing that?
Thanks,
Rob
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|