|
I found this:
.mresource public RDC.controls.DetailsActions.resources
{
}
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Then in your DetailsActions.cs (assuming similar class and filename) do this:
new ResourceManager(typeof(DetailsActions)) The ResourceManager uses the Type namespace and class name and appends ".resources" to get the resource. If you were to specify the resource yourself, you would have to do:
new ResourceManager("RDC.controls.DetailsActions.resources", Assembly.GetExecutingAssembly()); Though the example isn't right, you might - for sanity's sake - look in the ResX file to make sure a data name with "imageList1.Images" (or whatever the key is) exists in the file.
Any class defaults to using the project's root namespace (configured in the project) + any folders. This is for C#. VB.NET, on the other hand, builds the namespace up for each folder and is not cummulative. Make sure your class files don't repeat namespace parts for folder that already exist.
Resources, in both cases, are handled like classes in VB.NET: the "namespace" is built from the project root namespace + any folders down the line to the file to embed.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Heath Stewart wrote:
Though the example isn't right, you might - for sanity's sake - look in the ResX file to make sure a data name with "imageList1.Images" (or whatever the key is) exists in the file.
Did that - it's there. It's .ImageStream, I believe, either way, it's the same thing the code that blows up is looking for.
Heath Stewart wrote:
new ResourceManager(typeof(DetailsActions))
Sorry, it did that originally, and I've changed it back. I should have said when you mentioned it before.
I really appreciate your help with this.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Make sure your source file in VB.NET doesn't include the full namespace, like:
Namespace RDC
Namespace controls
Public Class DetailsActions
' ...
End Class
End Namespace
End Namespace What will happen, if the project's root namespace is "RDC" already, and this in a folder calls "controls", is that you'll have a fully-qualified class as RDC.controls.RDC.controls.DetailsActions .
If you're using the other overload for ResourceManager to specify the name, specify exactly the name you saw in the assembly manifest when using ildasm.exe, including the extension.
I feel so dirty writing VB.NET code in the C# forum.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
In VB.NET, it doesn't include a namespace at all. Could this be the problem ?
Heath Stewart wrote:
If you're using the other overload for ResourceManager to specify the name, specify exactly the name you saw in the assembly manifest when using ildasm.exe, including the extension.
I'm using the typeof one again now, because that's what it was originally, I was just looking for a way to specify the namespace, but it didn't help.
Heath Stewart wrote:
I feel so dirty writing VB.NET code in the C# forum
*grin* what's happening here is that we're being paid to work on some code that was in VB, and we refused unless we could convert it to C#. We did this, using a conversion tool, and the authors of the tool can't tell us why this is happening, although it has something to do with the subfolder, all the other image lists are not in subfolders, and work fine.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian Graus wrote:
In VB.NET, it doesn't include a namespace at all. Could this be the problem ?
It shouldn't. Whatever namespace is specified in the source file is appended to the namespace built up by the root project namespace plus any folders. At least that's what I remember from my stint with VB.NET 1.0 years ago.
Use ildasm.exe to view the type metadata. I'm sure you're answer lies there.
Christian Graus wrote:
I'm using the typeof one again now, because that's what it was originally, I was just looking for a way to specify the namespace, but it didn't help.
Once you get everything figured out, this is best. This allows you to move the source file and ResX file around in VB.NET. That's one nice thing. In C# you'd have to mind your namespace in the source file.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
OK, well all it tells me is what I know - the full 'path' is RDC.controls.imageList.ImageCollection. I know that the .controls bit is what's making the problem, but I do not know what to do about it. I'm going to read Pezold about it tonight and see if he says anything. His windows forms book is full of info on GDI+, but very thin on what controls he actually even uses, so it's a mixed bag.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
The namespace is RDC.controls , but what are you referring to as a "path"? I can help you (I've dealt more with localization of managed application than most people I know), but I need to understand what you're looking at exactly.
The source file will have a namespace, but in VB.NET - unlike in C# - you don't specify the entire namespace (if any) in the source file. If you use ResourceManager and pass it a Type to the constructor, then the namespace of the embedded resource and the namespace of the class must be the same, as do the class names. The embedded resource simply adds .resources to get the resources file.
So, if the fully-qualified class name is RDC.controls.imageList.ImageCollection - which doesn't make any sense from what you've told me already - then the .resources file should be embedded as RDC.controls.imageList.ImageCollection.resources.
The VB.NET project treats source files and embedded resources the same. It builds up their namespaces using the project root namespace + any folders up to the file.
Yesterday you told me that the class was RDC.controls.DetailsActions . When you say "path", are you talking about the data name in the ResX file? The name in the ResX file should match the name that you get using ResourceManager.GetObject .
If you specify a "path" (fully-qualified manifest resource name) for ResourceManager than it must include the entire "path": RDC.controls.DetailsActions.resources.
If you can, why not post some sample source and the structure of your project. And define what you mean by "path" and to what that "path" refers.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Stop the presses !!!
Thanks for all your help - I tried loading the resourcemanager with this:
System.Resources.ResourceManager resources = new System.Resources.ResourceManager("RDC.controls.DetailsActions", System.Reflection.Assembly.GetExecutingAssembly());
and it works fine. I'm at a loss though, I'm sure this is what I tried yesterday....
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Have you checked the 'DefaultNamespace' property of your project? The namespace in which a .resx file is placed is determined by studio to be:
[DefaultProjectNamespace].([Folder].[Folder].etc).ResourceFileName
If this production does not match exactly the declared namespace for your class, the ResourceManager won't be able to find the resources for the class. This has happenned to me on numerous occasions after moving around classes in a project that has a non-standard DefaultProjectNamespace (e.g. it's not just 'AssemblyName').
--
Russell Morris
"So, broccoli, mother says you're good for me... but I'm afraid I'm no good for you!" - Stewy
|
|
|
|
|
...and that's what I've been saying, but putting into a visual is a much better approach it would seem.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
This is kinda low-fi, but have you looked for your resource by outputing Assembly.GetManifestResourceNames()?
Also, reflector provides a list of all the resources in the assembly.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
hi every 1 ,
i'm doing a simple chat program and i want to set the text font,color and size for the sent message so that the reciever recieve it colored,.... any 1 can help me ?
in the client side there is a textbox where the recieved data appeared, should i change it ? Help Please
|
|
|
|
|
What you need is a RichTextBox. Read about it on MSDN
|
|
|
|
|
|
|
The System.Drawing.Point Class has really a lot of missing Features. It has no TypeConverter and no support for operators like + and -. This is really weak.
Is there any possibility to fix that issue? Sure... I could write an own Point class but that one won't be compatible with all the (drawing-)functions like DrawPoly and I don't want to write some ugly conversion code.
|
|
|
|
|
|
Actually you seem to be clueless...
[Serializable, StructLayout(LayoutKind.Sequential), TypeConverter(typeof(PointConverter)), ComVisible(true)]
public struct Point
{
public static readonly Point Empty;
public Point(int x, int y);
public Point(Size sz);
public Point(int dw);
public bool IsEmpty { get; }
public int X { get; set; }
public int Y { get; set; }
public static implicit operator PointF(Point p);
public static explicit operator Size(Point p);
public static Point operator +(Point pt, Size sz);
public static Point operator -(Point pt, Size sz);
public static bool operator ==(Point left, Point right);
public static bool operator !=(Point left, Point right);
public static Point Ceiling(PointF value);
public static Point Truncate(PointF value);
public static Point Round(PointF value);
public override bool Equals(object obj);
public override int GetHashCode();
public void Offset(int dx, int dy);
public override string ToString();
}
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
Yes indeed, and everything is explained on MSDN. All my fault
Actually I tried to convert a string into a point and also tried to sumarize two Points. Well, at least now I know how it works
|
|
|
|
|
in the Button1_Click I need to make the 1st column saved as readonly.
How can I do this?
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Xml.Xsl;
using System.Xml;
namespace PDM.excel
{
///
/// Summary description for WebForm3.
///
public class WebForm3 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
public SqlConnection conDB = new SqlConnection();
static public string[] LanguageStr =
{
"English","French","Spanish"};
static public string[] DropDownListStr =
{
"Language_DropDownList"};
protected System.Web.UI.WebControls.DropDownList Language_DropDownList;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button Button1;
static public string[][] AddStrArray =
{
LanguageStr};
private void Fill_DropDownList()
{
for (int i = 0; i < DropDownListStr.Length; i++)
{
string CtrlName= DropDownListStr[i];
DropDownList MyList = (DropDownList)Page.FindControl(CtrlName);
// Populate all the checkboxes
string[] ToPopulate = AddStrArray[i];
for (int j = 0; j < ToPopulate.Length; j++)
{
MyList.Items.Add(new ListItem(ToPopulate[j], j.ToString()));
}
}
}
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if(!Page.IsPostBack)
{
Fill_DropDownList();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.Language_DropDownList.SelectedIndexChanged += new System.EventHandler(this.Language_DropDownList_SelectedIndexChanged);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
public DataSet DataToExcel = new DataSet();
private void Language_DropDownList_SelectedIndexChanged(object sender, System.EventArgs e)
{
int getSelectedIndex = Language_DropDownList.SelectedIndex+1;
conDB.ConnectionString = "data source=10.195.17.7;database=devnew;uid=bounaajak;pwd=ehsfirst;packet size=4096";
SqlDataAdapter da = new SqlDataAdapter("Select string_id, string from pdm_translations where language_id = 1 and string_id not in (select string_id from pdm_translations where language_id = " + getSelectedIndex.ToString() + ") ", conDB);
da.Fill(DataToExcel, "DataToExcel");
Session["Tabla"] = Language_DropDownList.SelectedItem.Text;
DataToExcel.WriteXml(Server.MapPath(Session["Tabla"] + ".xml"));
DataGrid1.DataSource = DataToExcel;
DataGrid1.DataBind();
Language_DropDownList.Visible = false;
}
private void Button1_Click(object sender, System.EventArgs e)
{
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath(Session["Tabla"] + ".xml"));
XmlDataDocument xdd = new XmlDataDocument(ds);
XslTransform xt = new XslTransform();
xt.Load(Server.MapPath("Excel.xsl"));
xt.Transform(xdd, null, Response.OutputStream);
Response.End();
}
}
}
|
|
|
|
|
in the Button1_Click I need to make the 1st column saved as readonly.
How can I do this?
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Xml.Xsl;
using System.Xml;
namespace PDM.excel
{
///
/// Summary description for WebForm3.
///
public class WebForm3 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
public SqlConnection conDB = new SqlConnection();
static public string[] LanguageStr =
{
"English","French","Spanish"};
static public string[] DropDownListStr =
{
"Language_DropDownList"};
protected System.Web.UI.WebControls.DropDownList Language_DropDownList;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button Button1;
static public string[][] AddStrArray =
{
LanguageStr};
private void Fill_DropDownList()
{
for (int i = 0; i < DropDownListStr.Length; i++)
{
string CtrlName= DropDownListStr[i];
DropDownList MyList = (DropDownList)Page.FindControl(CtrlName);
// Populate all the checkboxes
string[] ToPopulate = AddStrArray[i];
for (int j = 0; j < ToPopulate.Length; j++)
{
MyList.Items.Add(new ListItem(ToPopulate[j], j.ToString()));
}
}
}
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if(!Page.IsPostBack)
{
Fill_DropDownList();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.Language_DropDownList.SelectedIndexChanged += new System.EventHandler(this.Language_DropDownList_SelectedIndexChanged);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
public DataSet DataToExcel = new DataSet();
private void Language_DropDownList_SelectedIndexChanged(object sender, System.EventArgs e)
{
int getSelectedIndex = Language_DropDownList.SelectedIndex+1;
conDB.ConnectionString = "data source=10.195.17.7;database=devnew;uid=bounaajak;pwd=ehsfirst;packet size=4096";
SqlDataAdapter da = new SqlDataAdapter("Select string_id, string from pdm_translations where language_id = 1 and string_id not in (select string_id from pdm_translations where language_id = " + getSelectedIndex.ToString() + ") ", conDB);
da.Fill(DataToExcel, "DataToExcel");
Session["Tabla"] = Language_DropDownList.SelectedItem.Text;
DataToExcel.WriteXml(Server.MapPath(Session["Tabla"] + ".xml"));
DataGrid1.DataSource = DataToExcel;
DataGrid1.DataBind();
Language_DropDownList.Visible = false;
}
private void Button1_Click(object sender, System.EventArgs e)
{
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath(Session["Tabla"] + ".xml"));
XmlDataDocument xdd = new XmlDataDocument(ds);
XslTransform xt = new XslTransform();
xt.Load(Server.MapPath("Excel.xsl"));
xt.Transform(xdd, null, Response.OutputStream);
Response.End();
}
}
}
|
|
|
|
|
First I should mention that I'm not sure if it can be done since I've never tried. Second, creating readonly columns in excel is an excel document specific action which means you will most likely have to use office automation to achieve what you want. In case you're not familiar with it, office automation provides a way to programmatically control MS Office applications.
Best Regards.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I'm trying to determine the best way to establish the address offset in array.
Example in C:
// **** begin code snippet
unsigned char data[256]; // with some kind of data in it.
unsigned char *result;
result = data+0x20; // copies data at offset address of 0x20
// **** end code snippet
Now how I need to set that up in C#? (correct me if I'm wrong!)
// **** begin code snippet
byte[] data = new Byte[256]; // with some kind of data in it.
byte[] result;
result = data+0x20; // copies data at offset address of 0x20
// **** end code snippet
|
|
|
|
|
I don't believe you can do pointer arithmetic in C#, but arrays are actually classes in C#, and they have a copy method. Obviously, then you end up with two arrays, not a smaller array into the same data, as you would with the C++ code here.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|