|
|
Finally some one has answered!!!
|
|
|
|
|
Hello
I develop a simple desktop application of sales management.
In my application in shipment report have 4 parameter
Report View by
Invoice
Date
Buyer
Product
I used ratio button in form so user can chose only one parameter at a time to view report
now i want to use check boxes user can chose multiple parameter use at a time to view report
Can you please suggest me how i can do this in short coding
Hope I clear my query
Thanks
|
|
|
|
|
hi all , i use this code to fill datagrid with data from my database
private void btn_by_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
SqlConnection con = new SqlConnection("Data Source=MS-TOSHIBA;Initial Catalog=dalily system;Integrated Security=True");
SqlCommand cmd = new SqlCommand("select place.name,place.address,place.telephone,place.website,place.email,place.info from place,subcateogry where place.subcat_id=subcateogry.id And subcateogry.name='" + subcat_comboBox.SelectedItem.ToString() + "' ", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
dt.Load(dr);
dataGridView1.DataSource = dt;
dr.Close();
con.Close();
}
now i want when i click on row
select coordinate_x & coordinate_y from place table where name is in row i clicked on
And store coordinate_x & coordinate_y as double
thanks in advance
|
|
|
|
|
Just stop posting the same question twice in a row. There's no need and you're not drawing any more attention to your question. You're drawing it to yourself and not in a good light either.
|
|
|
|
|
i don't want to do that but there is a problem with my browser so when i click post nothing happen so i think my question not posted
|
|
|
|
|
Then you can check to see if it has been posted before doing it again.
|
|
|
|
|
hey,
my company wrote an activeX DLL in VB6 few years back, and now i've been asked to run some tests with it.
since i dont have VB6 environment anymore, i thought it'll be best to try and make a simple C# program that will call the registered COM Dll.
to do that i copied the DLL into c:\windows\system32, used regsrv32 to register the DLL, restarted the computer and referenced to it from my project.
from there i tried working like i use to:
mydll.cMain obj = new mydll.cMain();
int res;
res = obj.SetHttpServer("www.test.com", 80);
res = obj.PingServer();
with the first method call (SetHttpServer) Everything worked fine,
on the second method call (PingServer) i keep on getting Error# 429 " ActiveX component can't create object".
i looked over the original VB class, and it seems pretty simple, it creates an HttpWebRequest object and requests a string from the webserver defined with the SetHttpServer.
What am i doing wrong?
Thank you
Alon
|
|
|
|
|
Does the .DLL have any dependencies that you didn't copy over??
Use this[^] to find out.
|
|
|
|
|
Hey Dave,
that was my first thought too,
my dll depends on MSVBVM60.DLL which uses other windows DLL..
since i use Windows 7 (or Windows xp sp3 in another computer i tried) i found the file already to be located at 'system32' folder.
do i need to register the msvbvm60 file as well?
|
|
|
|
|
No, it's already there and done.
|
|
|
|
|
I have the following two variables
[code]
bytes_per_pixelS = 2;
byte[] stbd_data = new byte[stbd_width * num_lines * bytes_per_pixelS];
Array pingDataArray = new ushort[stbd_width * num_lines];
[/code]
To assign stbd_data to pingDataArray, which one is correct, knowing that stbd_data array is twice as long as the pingDataArray....
[code]
for (int i = 0; i < stbd_width * num_lines; ++i)
{
pingDataArray.SetValue( BitConverter.ToUInt16 (stbd_data ,2*i),i);
} }
[/code]
or
[code]
for (int i = 0; i < stbd_width * num_lines; ++i)
{
pingDataArray.SetValue( BitConverter.ToUInt16 (stbd_data ,i),i);
}
[/code]
thanks
|
|
|
|
|
I'm having issue understanding how I can read XML from a webservice.
What webservice is sending back an object array that contains XmlAttribute and XmlElements within the array.
Most of what I am finding on how to parse an XML response they are either deserializing it and converting it to their custom class or they are loading from a file.
In my case I can't do neither since what is returned is an object[].
I'm not asking for code.. just some help to point me in the right direction on what process I should take for reading this information.
|
|
|
|
|
If the objects within the array are well-formed XML in strings, then you can use an XmlDocument and its LoadXml method then go from there.
But maybe you need to read up more on deserialization.
|
|
|
|
|
The problem is objects within the array are not strings. They are of type XmlAttribute and XmlElement.
So this is the return I am supposed to get:
<response code="200" name="success">
<message>Domain domain.com exists</message>
</response>
But it returns:
object[] getData = soap.domainExists("domain.com");
So within getData is:
getData[0] = XmlAttribute (type)
getData[1] = XmlElement (type)
getData[2] = XmlElement (type)
getData[3] = XmlElement (type)
|
|
|
|
|
I see. I did this:
object[] blah = soap.domainExists("domain.com", param);
foreach (object o in blah)
{
Type t = o.GetType();
Console.WriteLine(t);
if (t == typeof(XmlElement))
Console.WriteLine(((XmlElement)o).InnerXml);
else if (t == typeof(XmlAttribute))
Console.WriteLine(((XmlAttribute)o).InnerXml);
}
Which returns:
<key xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>status_code</key><value xsi:type="xsd:int" xmlns:xsi="http://www.w3.org/2001/XM
LSchema-instance">200</value>
System.Xml.XmlElement
<key xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>status_name</key><value xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001
/XMLSchema-instance">success</value>
System.Xml.XmlElement
<key xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>status_message</key><value xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2
001/XMLSchema-instance">Domain domain.com exists</value>
I jsut need to figure out how to parse it
modified 12-Jun-12 14:49pm.
|
|
|
|
|
JD86 wrote: I'm having issue understanding how I can read XML from a
webservice. What webservice is sending back an object array that
contains XmlAttribute and XmlElements within the array.
From this and your other posts I am pretty sure your problem is that you want to
1. Get the xml
2. parse the xml
3. turn it into some sort of data structure.
Steps 2 and 3 have nothng to do with a "webservice". Steps 2/3 are the same regardless of where the xml comes from.
As far as a solution to 2/3 then the steps are.
A. FIRST determine what is in the xml.
B. Second learn how to parse xml.
C. Write code using B and knowledge from A to produce what you want.
|
|
|
|
|
Thanks.
The problem I'm having is I'm expecting/wanting something in the format:
<response code="200" name="success">
<message>Domain domain.com exists</message>
</response>
Which is what you get if you browse to the webpage.
But I'm getting the format shown above which is completely different and more difficult to parse from what I can tell
|
|
|
|
|
Ok I just parsed it my own way
<pre lang="c#">
object[] blah = soap.domainExists("domain.com", param);
bool success = false;
string msg = string.Empty;
ParseXml(blah, out success, out msg);
</pre>
<pre lang="c#">
static void ParseXml(object[] data, out bool success, out string message)
{
success = false;
message = "Failed to parse XML";
// Loop through objects
foreach (object o in data)
{
// We only care about XmlElement. Ignore the XmlAttribute
if (o is XmlElement)
{
// Get the innerText
string text = ((XmlElement)o).InnerText;
if (text.StartsWith("status_code"))
{
if (text.Replace("status_code", string.Empty).Equals("200", StringComparison.CurrentCultureIgnoreCase))
success = true;
}
else if (text.StartsWith("status_message"))
{
message = text.Replace("status_message", string.Empty);
}
}
}
}
</pre>
|
|
|
|
|
We are having issue with URL Rewriting, when we publish the code (in VS 2005).
In unpublished code it worked fine. But When we publish the code in following two cases:
1) By Putting the Global.asax file in root folder.
2) By putting the Global.asax file in App_Code Folder.
In First case, URL Rewriting is done for the first time, but when any post back is Occurred due to any Button click, the page is refreshed, and the Button click event is not called.
In Second case, every thing works fine except the URL Rewriting part, now URL is not rewritten on any page. But all postbacks occurred correctly.
We are currently unable to findout the reason for this behaviour. May be we are using session to store the value of lastURL (in Application_AcquireRequestState of Global.asax), and it could be possible that in unpublished code session is accessible but not in published code (any ideas). The code is given below(just for suggestion):
RewriteURL.Cs code:
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;
namespace WebURL
{
public class RewriteURL : IHttpModule
{
ManageCatSubCat objCat = new ManageCatSubCat();
public RewriteURL()
{
}
public void Init(HttpApplication application)
{
application.BeginRequest += (new EventHandler(this.Application_BeginRequest));
}
public void Dispose()
{
}
private void Application_Disposed(Object source, EventArgs e)
{
}
void Application_BeginRequest(object sender, EventArgs e)
{
string fullOrigionalpath = HttpContext.Current.Request.Url.ToString().ToLower();
if (fullOrigionalpath.EndsWith("/scrapoffers/selloffer"))
{
HttpContext.Current.RewritePath("~/sellofferdefault.aspx?OfferType=SellOffer");
}
}
}
}
Global.asax code:
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
}
void Application_End(object sender, EventArgs e)
{
}
void Application_Error(object sender, EventArgs e)
{
}
void Application_AcquireRequestState(object sender, EventArgs e)
{
string strLastURL = "";
string fullOrigionalpath = HttpContext.Current.Request.Url.ToString().ToLower();
if (fullOrigionalpath.Contains(".aspx"))
{
if (fullOrigionalpath.Contains("/sellofferdefault.aspx?offertype=selloffer") && fullOrigionalpath != strLastURL)
{
HttpContext.Current.Session["LastAccessURL"] = fullOrigionalpath;
HttpContext.Current.Response.Redirect("~/ScrapOffers/SellOffer");
}
}
}
void Session_Start(object sender, EventArgs e)
{
}
void Session_End(object sender, EventArgs e)
{
}
</script>
In web.config file:
<pre lang="c#"><system.web>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
<remove verb="*" path="js.axd"/>
<add verb="*" path="js.axd" type="DC.Web.HttpCompress.CompressionHandler,DC.Web.HttpCompress"/>
</httpHandlers>
<httpModules>
<add name="rewriteurl" type="WebURL.RewriteURL"/>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="HttpCompressModule" type="DC.Web.HttpCompress.HttpModule,DC.Web.HttpCompress"/>
</httpModules>
</system.web>
How is how we are Publishing the Code:
Open the web project in VS 2005 and then Going to Build Menu and Click Publish Website submenu and giving target Location and Checking all the 4 checkboxes :1) Allow this Precompiled site to be updatable
2)Use fixed naming and single page assemblies.
3)Enable Strong Naming on Precompiled assemblies.
And when you will check this checkbox then Selecting the radio button Use a Key Container and Key Container text box is empty. And then checking the below checkbox.
4)Mark assemblies with allowpartiallyTrustedCallerAttribute(APTCA)
|
|
|
|
|
I'm dealing with what I think might be a bug in Visual Studio 2010 Professional. I have several forms in my application (WinForms, .NET 4x) which use a SplitContainer to provide a button panel (OK, Cancel, etc.) at the bottom of the form. I set the SplitContainer.FixedPanel to Panel2 and SplitContainer.IsSplitterFixed to true.
The form in question has SplitContainer objects nested 3 deep with DataGridView components in 3 of the panels and buttons in the 4th.
Now every time I press F6 to compile, the main parent SplitContainer.SplitterDistance is incremented by a value of 3. This happens with each F6 press until the components on Panel2 are being truncated on the lower edge of the panel.
I tried to duplicate the behavior by adding the same components to a new form. It wasn't until I added DataGridView components to some of the panels that the SplitterDistance of the main splitter component changed on compile. I'm guessing that the problem has to do with the complexity of the form and not with the DataGridView components specifically.
In general, I've had several problems with components not maintaining their positions during development. I can finish working on a form and return later to find everything moved around. Very frustrating
Has anyone else seen this behavior? Is there a workaround?
Thanks....
|
|
|
|
|
I've seen similar things even going back to VS 2002, but not that exact thing. And I don't know a way around it.
Can you reset the position in the Load method?
|
|
|
|
|
PIEBALDconsult wrote: Can you reset the position in the Load method?
I might be able to but having to position each component at run-time wouldn't be practical and I won't know for certain which components are mobile unless I check each component on each form with every compile.
|
|
|
|
|
Steve Harp wrote: Is there a workaround?
Make all your source-files readonly before building. As far as I can see, compiling does not modify the original sources - but if the window is open in the designer, then it might try to update it's contents in the Forms Editor.
Bastard Programmer from Hell
|
|
|
|
|
Eddy Vluggen wrote: Make all your source-files readonly before building. As far as I can see, compiling does not modify the original sources - but if the window is open in the designer, then it might try to update it's contents in the Forms Editor.
Your suggestion led me to another discovery. The value is incrementing when the IDE loads the form; not when it compiles. Apparently, the IDE reloads the form after a build and that's why I associated it with compiling. This is even worse because I can't very well change it to read-only as it's being loaded for editing. If I can't trust the IDE to load a form without modifying it, this means I have to check the position of every component on every form I edit before I save. This can't be right.
|
|
|
|