|
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
|
|
|
|
|
You can do pointer arithmetic if you use an unsafe block (and tell the compiler to allow it with the /unsafe command-line switch) and pin data n memory:
using System;
class Test
{
unsafe static void Main()
{
byte[] data = new byte[256];
for (int i=0; i<data.Length; i++)
data[i] = (byte)i;
byte[] result = new byte[data.Length - 0x20];
fixed (byte *b1 = &data[0x20])
fixed (byte *b2 = &result[0])
*b2 = *b1;
Console.WriteLine(result[0]);
}
} See my reply to him if you're interesting in what you already recommend: Array.Copy .
What is confusing is that he says "copy" but is only referencing data in his example.
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]
|
|
|
|
|
Actually, neither example is copying data. You're pointing result at the element at offset 0x20 (32) from data in the native code.
As Christian said, you can use Array.Copy if you actually want to copy data:
byte[] data = new byte[256];
byte[] result = new byte[256 - 32];
Array.Copy(data, 0x20 , result, 0, 256 - 32); In your native code, if you want to copy - no reference - the data, you need to do something like so:
malloc(&result, 256 - 30);
memcpy(result, data + 0x20 , 256 - 32); See my reply to Christian for how you can do pointer arithmetic (which is, remember, just referencing - not copying) if you're interested.
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]
|
|
|
|
|
I need to indicate on a windows form that it's not in normal mode, but is in template mode. I was thinking one neat way to do it would be to put a diagonal 'watermark' text saying TEMPLATE across the form that doesn't interfere with the controls at all.
Kinda like the TOP SECRET or CONFIDENTIAL you see stamped on pages in movies.
I'm not very up on the graphics and drawing elements of windows forms, but I attempted to draw text over the form to no avail, I used the form.CreatGraphics method to get a graphics object but it seems to always draw behind the panels and controls which makes sense I think since it's a graphics object of the underlying form. I guess I need one that is for the whole window in general?!?
I need something that draws right overtop of everything but doesn't interfere with the normal control usage and is only present for that form window (i.e. if a user goes to their desktop or something it is not still there).
I'm guessing this isn't possible, but I thought I would check with the experts here before giving up entirely on the idea.
|
|
|
|
|
If it is possible, it's not trivial. You would probably have to determine the position of each of the controls and draw pieces of your image on the individual controls according to the place of the entire image over the form.
Say that you call CreateGraphics and get the graphics context for the form. You then create an offscreen context on which you draw your diagonal text. Then you iterate through your controls and find their position and size on the form. Then you clip the region of the offscreen graphics containing your text according to the position and size and then draw it on the control from which you got those dimensions. Although, I think that if you override the drawing of each individual control, you may cause your controls to function improperly. Anyhow, though it's probably possible I'm fairly certain it is not worth the effort.
Best Regards.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Yikes! Wow, no, definitely not worth the effort! Thank you for confirming that. I'll stick with something simpler I guess.
Cheers!
|
|
|
|
|