|
hi all,
how can i get my computer's ip or mac address with c# ?
is there a tutorial to learn much about getting tcp/ip settings ?
thanks in advance, bye.
|
|
|
|
|
http://www.codeproject.com/cs/internet/host_info_within_network.asp
|
|
|
|
|
This possible in .NET 2.0.
|
|
|
|
|
Mehmet Fatih Akbulut wrote: how can i get my computer's ip or mac address with c# ?
Mac Address[^]
IP Address[^]
You can try googling to get more details.
Tarakeshwar
MCP, CCIE Q(R&S)
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes.
!sgub evah t'nseod margorP sihT ?sgub naem ayaddahW
|
|
|
|
|
Hi!
I don't even know if this is possible or not...
I have an (3rd Party) application, that writes text into a logfile. I want to intercept this filestream an handle it in my own application. Is it possible (and how is it possible?) to redirect the stream into my application (or to get a copy of it)? I suppose that I have to use some win32-Api functions to achieve this.
Any help is appreceated
Thanks
Dirk
|
|
|
|
|
|
thanks a ton in advance
how should we add for value members and display members if binding is through the datareader and not dataset
currently i add using a loop due to which i cannot set the value memebers and display members had i done that using datasets
ComboBox1.Items.Clear()
If (dr !=null)
{
while (dr.Read())
{
ComboBox1.Items.Add(dr"Name"]);
}
}
The secret of gettting ahead is getting started
|
|
|
|
|
Why don't you use the datareader to populate the dataset?
|
|
|
|
|
thanks paul,
what you suggested can be done , But Just wanted to know if using datareader directly against combobox and setting value members and display members is possible ..
and again
if i am using datareader to fill the dataset against dataadapter , what difference in the performance will it make (please consider this query to be on lower priority;))
please tell if some work around is possible ..
|
|
|
|
|
Hi All,
My app is MTA, because it needs to be for directshow. I'm now wanting to use OpenFileDialog, but it seems to not work: calling ShowDialog results in a ThreadStateException with additional information
"Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process"
Anyone got any ideas for an alternative or a workaround? My main thread needs to stay MTA, or directshow stuff i'm doing will not work.
Any help greatly appreciated!
Jon
using System.Beer;
|
|
|
|
|
Hello
Why don't you make another STA thread, and show the openfile dialog within it?
|
|
|
|
|
Problem with that is that if i show the dialog from another thread then i can do one of two things with my UI thread:- either Join on the worker thread (which locks the UI to the extent that it won't even redraw), or i can use a callback/message/event and invoke the dialog asyncronously - but then the main app's UI will be active because the dialog won't be modal.
using System.Beer;
|
|
|
|
|
Well, I anticipated this, but I believe the solution is simple.
1- Make a bool value that is always false
2- At each UI event (click, highlight, etc...) you check that value, if it's false continue
3- When you show the openfileDialog -or just any other dialog- you set this value to true and create and object reference to that dialog (of type Control maybe)
4- When the dialog returns, you set it to false again -so that the UI will work again-, then process the data returned by that dialog
In the Focus event -when the user set the focus to your main Application- check if the object reference is null, if not call its Control.Focus();
This way when the user clicks or moves the mouse around you'll still be able to draw your UI, yet the user won't be able to use it until the dialog returns. Also he won't be able to change focus until the dialog return.
I know it's a bit lousy way, but that is what I can think of.
I hope it works
|
|
|
|
|
Hi Guru's
I recently moved from C++ to C# and so far, so good! But I do seem to have a little problem with displaying my reports designed with our good friend crystal reports! I am writing a simple Point Of Sale application for one of our clients, but I can't seem te send the reportviewer a SQL or "Format" string.
When the user selects the report he/she wants to see, I pop up a little dialog with a list that displays some invoice numbers. The user selects the invoice number and click on the "Print" button... and it displays the report... Brilliant!! BUT... with ALL the entries in my table!
How do I pass the invoice number to the report and have it display all entries of the selected invoice number only? In C++ I used to, grab the values from my little dialog, construct a SQL statement using those values, pass it to my report and display it! I am almost sure one should be able to do the same in C#.
Can anybody help me with this please!?
Many, MANY thanx!
Willem Le Roux
|
|
|
|
|
Willem_Le_Roux wrote: How do I pass the invoice number to the report and have it display all entries of the selected invoice number only?
You have an option in the report to set parameters. You can set a parameter and then you can send the parameter from the dialog box.
You could write a function like this
<br />
private ParameterField AddParameter (string paramName, string paramValue)<br />
{ <br />
ParameterField paramField= new ParameterField();<br />
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue ();<br />
ParameterValues paramValues = new ParameterValues ();<br />
paramField.ParameterFieldName = paramName; <br />
paramDiscreteValue.Value = paramValue;<br />
paramValues.Add (paramDiscreteValue);<br />
paramField.CurrentValues = paramValues;<br />
<br />
return paramField;<br />
}<br />
And to add a parameter
<br />
private CrystalDecisions.Windows.Forms.CrystalReportViewer crResults;<br />
crResults = new CrystalDecisions.Windows.Forms.CrystalReportViewer();<br />
<br />
rptMyReport crReportDocument = new rptMyReport();<br />
crResults.ReportSource = crReportDocument;<br />
<br />
CrystalDecisions.Shared.ParameterFields paramFields = crResults.ParameterFieldInfo; <br />
paramFields.Add(AddParameter("paramName",strValue)); <br />
Tarakeshwar
MCP, CCIE Q(R&S)
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes.
!sgub evah t'nseod margorP sihT ?sgub naem ayaddahW
-- modified at 9:19 Monday 26th June, 2006
|
|
|
|
|
Hi Tarakeshwar!
In future I promise to write a little article on the subject and I will be sure to put your name all over the place. I will also do all future communication via the forums for all to see. Sorry about that my fellow gurus!
I made the requested changes and and the "report.Load(strReportPath);" seems to be working now.
But I am still having a problem with the line "paramFields.Add(AddParameter(PARAMETER, strTransactNo));" When I run the application it states that "Object reference not set to an instance of an object".
Willem Le Roux
I wish that the designers of programming languages would start writing their error messages in English...
-- modified at 7:30 Wednesday 28th June, 2006
|
|
|
|
|
Have you added a crystal report viewer to your screen and named it as crystalReportViewer? I amnot sure why your getting that error.
Can you debug and tell me the exact point your getting this error and if you can put a try catch and paste the error here.
Tarakeshwar
MCP, CCIE Q(R&S)
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes.
!sgub evah t'nseod margorP sihT ?sgub naem ayaddahW
|
|
|
|
|
My Crystal Report Viewer is the only control on my frmReport form. The Crystal Report Viewer's name is "crystalReportViewer".
The try/catch is showing the following error:
System.NullReferenceException: Object reference not set to an instance of an object. At ProgName.frmReport.ConfigReport() in D:\ProgName\ProgName\frmReport.cs:line 47
And the line of code on Line 47 is
paramFields.Add(AddParameter(PARAMETER, strTransactNo));
In despiration I added a few MessageBoxes to see were exactly the error happens. As It runs through AddParameter(string paramName, string paramValue) it seems to catch the exception just before "return paramField;"
Why... I don't know.
Willem Le Roux
|
|
|
|
|
I have tried to have a look at it, I am not sure why your getting that error. I would suggest you to see what is the paramName and paramValue inside the AddParameters function, probably its going as null or something.
Tarakeshwar
MCP, CCIE Q(R&S)
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes.
!sgub evah t'nseod margorP sihT ?sgub naem ayaddahW
|
|
|
|
|
My goodness golly me... I dont know. I added the following to AddParameter function...
MessageBox.Show("Param Name: " + "*" + paramName.ToString() + "*");
MessageBox.Show("Param Value: " + "*" + paramValue.ToString() + "*");
and it displayed the following on screen...
Param Name: *TRASNACTNO*
Param Value: *Habula Lodge 2006\06\28 11:22:07 AM*
...seems correct.
I know this is a little beyond the norm and it might be seen as a little bit of "spoon feeding"... which it is I suppose, but is there any possablility that you could email me a little project with a working sample. This way I can compare code and see where I went wrong. I will understand if you say no... Company policies, extra effort and so on.
What ever way this goes, I want to thank you for your patience, time and quick responces! You rock man! Your help is much appreciated!
Willem Le Roux
|
|
|
|
|
Actually what I pasted you was from a working code I am using.
Have you declared the Paramenter TRASNACTNO in your crystal report?
And are you sure that your using the same spelling on TRASNACTNO and not TRANSACTNO in one place and TRASNACTNO in other.
Tarakeshwar
MCP, CCIE Q(R&S)
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes.
!sgub evah t'nseod margorP sihT ?sgub naem ayaddahW
|
|
|
|
|
That whole TRASNACTNO - TRANSACTNO thing was a typo from my side... Hehe. Sorry!
I must confess, I did not declare the TRANSACTNO parameter in Crystal, But I have now, and I seem to get the same error! I will go through all we have done so far, and check if I can spot something that is out of the norm.
Thanx for all your help so far buddy! I will be in contact...
Willem Le Roux
|
|
|
|
|
Can you perhaps paste your ConfigureReport() function in here again please?
Willem Le Roux
|
|
|
|
|
<br />
private CrystalDecisions.Windows.Forms.CrystalReportViewer crViewer;<br />
crViewer = new CrystalDecisions.Windows.Forms.CrystalReportViewer();<br />
<br />
rptSampleReport crResults = new rptSampleReport(); <br />
Database crDatabase; <br />
Tables crTables; <br />
Table crTable; <br />
TableLogOnInfo crTableLogOnInfo; <br />
ConnectionInfo crConnectionInfo = new ConnectionInfo(); <br />
<br />
crConnectionInfo.ServerName=strServerName;<br />
crConnectionInfo.DatabaseName = strDatabaseName; <br />
crConnectionInfo.UserID = strSqlUserName; <br />
crConnectionInfo.Password = strSqlPassword; <br />
<br />
crDatabase = crResults.Database; <br />
crTables = crDatabase.Tables; <br />
<br />
for (int i = 0; i < crTables.Count; i++) <br />
{ <br />
crTable = crTables [i]; <br />
crTableLogOnInfo = crTable.LogOnInfo; <br />
crTableLogOnInfo.ConnectionInfo = crConnectionInfo; <br />
crTable.ApplyLogOnInfo(crTableLogOnInfo); <br />
}<br />
<br />
crViewer.ReportSource=crResults;<br />
CrystalDecisions.Shared.ParameterFields paramFields= crViewer.ParameterFieldInfo;<br />
paramFields.Add(AddParameter("@TransactionID",strTransactionNo)); <br />
<br />
crViewer.Show();<br />
Tarakeshwar
MCP, CCIE Q(R&S)
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes.
!sgub evah t'nseod margorP sihT ?sgub naem ayaddahW
|
|
|
|
|
Hello, I am a new member of the code project and i have found this site to be a very interesting and helpful place. This is my first blog but this site have already helped me through so much. However i came accross one very confusing problem in .net. I am working with web services and i am creating a client for a service that someone else already have in place. I generated a proxy class from wsdl, with some complex type that if null will be notified by <var nil:true> no matter what the variable type is.
Now the problem is when i send in a request value that does not exists in their database, its normal for them to return null, but my application, the client application throw a nullreference exception. Saying that the input format is incorrect. I am a newbie with web service and i have been trying to trace the problem, when the search value exists this does not happen. Here is the stack trace and a sample soap message. Hope someone can help me out.. THankz.
<CP0307I01Response xmlns="namespace">
<EAIHeader>
<serviceId>ID</serviceId>
<beginTimestamp>2006-06-26T15:40:26.125+07:00</beginTimestamp>
<endTimestamp>2006-06-26T15:35:11.955+07:00</endTimestamp>
<transactionId>0f7a58bf0ac6321501fd4878a404f1f5</transactionId>
<sourceTransactionId>3000</sourceTransactionId>
<sourceSystem>RSB</sourceSystem>
<userId>user</userId>
<password>password</password>
<status>3</status>
<reasonCode>60007</reasonCode>
<reasonDesc>CPACholder not found</reasonDesc>
</EAIHeader>
<CPACholder>
<cardExpDate xsi:nil="true"></cardExpDate>
<cardholderID xsi:nil="true"></cardholderID>
<creditLimit xsi:nil="true"></creditLimit>
<currentAcctNo xsi:nil="true"></currentAcctNo>
<fstEbName xsi:nil="true"></fstEbName>
<ownCustObj xsi:nil="true"></ownCustObj>
<savingAcctNo xsi:nil="true"></savingAcctNo>
</CPACholder>
</CP0307I01Response>
Stack trace : err msg = "There is an error in xml document (4,677)"
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at CP0307I01.doService(EAIHeader& EAIHeader, CPACCardholder& CPACCardholder) in D:\e-MobileApplicationProjects\asynWebTest\asynWebTest\CP0307I01ProxyClass.cs:line 42
at asynWebTest.Program.Main(String[] args) in D:\e-MobileApplicationProjects\asynWebTest\asynWebTest\Program.cs:line 22
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Thznk in advance i have been trying to figure it out for many days hopefully someone with enough experience will know
Wicky
|
|
|
|