Quantcast
Channel: Visual C# forum
Viewing all 31927 articles
Browse latest View live

Accessing HP Engage One Model 143 Front Facing Display from Code

$
0
0

We have a UWP app running on a HP Engage One AiO System, Model 143.  It also has a front facing 2x20 inch display.  Anyone have experience programmatically controlling the display on this device.  We use VS2017 C# to develop the app.   Is there a Microsoft POS for .Net API that provides a way to do this?

TIA

Harry


Posting data to a web form in C#

$
0
0

Trying to send data to a web form. It always replies "400".

I can do it from an html page like so:

<form action="https://api.particle.io/v1/devices/4500*****3036/Settings?access_token=hidingthispart" method="POST">
        Tell your device what to do!<br><br><input type="text" name="arg" value="" > The settings string.<br><input type="submit" value="Do it!"></form>

But not from .net code like so:

   string postData = "arg=" + tbMaxChamber.Text + "," + tbMinChamber.Text + "," + tbMeatTarget.Text + "," + tbMeatAlert.Text;
            string url = "https://api.particle.io/v1/devices/4500***********63036/Settings?access_token=hidingthispart";

            WebRequest request = WebRequest.Create(url);
            request.Method = "POST";
            byte[] byteArray = Encoding.UTF8.GetBytes(postData);
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = byteArray.Length;
            Stream dataStream = request.GetRequestStream();
            dataStream.Write(byteArray, 0, byteArray.Length);
            dataStream.Close();

            WebResponse response = request.GetResponse();
            lblResponse.Text = (((HttpWebResponse)response).StatusDescription);

            dataStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(dataStream);
            string responseFromServer = reader.ReadToEnd();
            lblResults.Text = responseFromServer;
            reader.Close();
            dataStream.Close();
            response.Close();

Perhaps I have to do something different because it's an https?

Writing StringColleciton to an MS Access Long Text field

$
0
0

Hi,

I'm in the process of converting an old Delphi program to C#.  The data is stored in an MS Access DB.  The program has an in-memory object that encapsulates the data and much of the program functionality.  Among the fields in the object are a number of fields that are implemented as TStringList in Delphi.  The Delphi code uses the TStringList.Text property to write the data to an MS Access LongText field.  On the windows forms, the data is displayed (in Delphi) in TMemo fields.  In C#, it is displayed in multi-line text boxes. When I attempt to insert a line in the Access DB from C#, I get an error that seems to be objecting to the embedded NewLine characters in the data.

How should I go about this?  Is a StringCollection not the correct object to use to replace a Delphi TStringList.  I do need to preserve the line breaks in the data when I write to the DB.

Thanks,

Ray

Text message to PC

$
0
0

I want to upload my text message from my LG Android Phone to my PC so I can print them

TcpClient - Big Endian, Little Endian

$
0
0
Hello,
I implemented it that way, it works. If it has to be different, why always, are there better ways?
Could I use a ready-made function? From a library, if so, what's its name?
// Insert a 4-byte length of the message as Big Endian 
message = message.Insert(0, "    ");
byte[] messAsByte = System.Text.Encoding.ASCII.GetBytes(message);
int length = message.Length;
byte[] byteView = BitConverter.GetBytes(length);
messAsByte[0] = byteView[3];
messAsByte[1] = byteView[2];
messAsByte[2] = byteView[1];
messAsByte[3] = byteView[0];
bool retVal = socketClient.send(messAsByte);


Thanks in advance.
Best regards, Markus

timer not working in backgroundworker

$
0
0

i'm running a background worker and I have a timer that does all the work(supposed to) but the .tick never gets executed.  the DoWork calls the function that does this

tmrBuildDataTree.Interval = 5;
tmrBuildDataTree.Tick += TmrBuildDataTree_Tick;
tmrBuildDataTree.Enabled = true;

I can step through it and see this happen but the .tick function never kicks in...

I imagine it has something to do with the fact that its a backgroundworker... but dunno.

BadButBit


my code is perfect until i don't find a bug

How to get string output when converting a console application into a .dll?

$
0
0

hello,

I want to convert a console application to a .dll file,and get the result when load the dll,what I don't know is how to get the result in a dll file after converted.Below is the origin console code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.NetworkInformation;
using System.Diagnostics;
using System.Net;
using System.Threading;
using System.Net.Sockets;

namespace ConsoleApplication1
{
    class Program
    {
        static CountdownEvent countdown;
        static int upCount = 0;
        static object lockObj = new object();
        const bool resolveNames = true;

        static void Main(string[] args)
        {
            countdown = new CountdownEvent(1);
            Stopwatch sw = new Stopwatch();
            sw.Start();
            string ipBase = "192.168.1.";
            for (int i = 1; i < 255; i++)
            {
                string ip = ipBase + i.ToString();

                Ping p = new Ping();
                p.PingCompleted += new PingCompletedEventHandler(p_PingCompleted);
                countdown.AddCount();
                p.SendAsync(ip, 100, ip);
            }
            countdown.Signal();
            countdown.Wait();
            sw.Stop();
            TimeSpan span = new TimeSpan(sw.ElapsedTicks);
            Console.WriteLine("Took {0} milliseconds. {1} hosts active.", sw.ElapsedMilliseconds, upCount);
            Console.ReadLine();
        }

        static void p_PingCompleted(object sender, PingCompletedEventArgs e)
        {
            string ip = (string)e.UserState;
            if (e.Reply != null && e.Reply.Status == IPStatus.Success)
            {
                if (resolveNames)
                {
                    string name;
                    try
                    {
                        IPHostEntry hostEntry = Dns.GetHostEntry(ip);
                        name = hostEntry.HostName;
                    }
                    catch (SocketException ex)
                    {
                        name = "?";
                    }
                    Console.WriteLine("{0} ({1}) is up: ({2} ms)", ip, name, e.Reply.RoundtripTime);
                }
                else
                {
                    Console.WriteLine("{0} is up: ({1} ms)", ip, e.Reply.RoundtripTime);
                }
                lock (lockObj)
                {
                    upCount++;
                }
            }
            else if (e.Reply == null)
            {
                Console.WriteLine("Pinging {0} failed. (Null Reply object?)", ip);
            }
            countdown.Signal();
        }
    }
}

Specifying a range for a list input relative to previous list inputs

$
0
0

I'm trying to validate user input to a range which compares an input to previous inputs in a list, I can seem to find the syntax. I've written something indicative of what i'm trying to do, but the if statement that declares the range is obviously all wrong. My code reads as follows:

List<Opening> OpeningsList = new List<Opening>();

int MinRange = openingFromSOP + openingWidth + (int)StudCount() / 2 * (int)TimberThickness;
            if (openingFromSOP > MinRange.CompareTo(List<Opening> OpeningsList))
            {
                OpeningsList.Add(new Opening() { OpeningFromSOP = openingFromSOP - StudCount() / 2 * TimberThickness, DistanceOverOpening = openingFromSOP + openingWidth + StudCount() / 2 * TimberThickness, OpeningWidth = openingWidth + StudCount() * TimberThickness, OpeningHeadHeight = openingHeadHeight, OpeningCillHeight = openingCillHeight, LintelTicker = flag2 });
            }
            else
            {
                ContentDialog CillTooHigh = new ContentDialog
                {
                    Title = "Invalid input",
                    Content = "The opening is within the bounds of another opening.",
                    CloseButtonText = "Ok"
                };
            }

Any help would be appreciated, cheers, Matthew


Not all code paths return a value - Error

$
0
0

Hi,

I have a Users class in my DAL that I'm trying to project into a combobox. I've done this before in simular situations but for some reason I'm getting an error that I don't understand.

Here is the code where I get the error:

 public AddNewProject()
        {
            InitializeComponent();
            cmbUsers.ItemsSource = GetUserID(1).ToList();
        }

        public List<Users> GetUserID(int user)
        {
            var usr = new List<Users>();
            using (ProdTrackDevEntities context = new ProdTrackDevEntities())
            {
                usr = (from u in context.pt_User
                       select new Users
                       {
                           IDUser = u.IDUser,
                           LastName = u.LastName,
                           FirstName = u.FirstName
                       }).ToList();
            }
        }

Here is my Users class:

 public class Users
    {
        public int IDUser { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string FullName
        {
            get
            {
                return this.LastName + ", " + this.FirstName;
            }
        }
    }

Also attached it the picture of the error on line 28.

Thank you,

-Justair07

Getting value from child form to parent form?

$
0
0

I have a form, having tab control. Forms directly open in tab control as tab page. when i want to get data from child form to parent form. It gave error on owner ship of the form. Now i have changed the ownership of the form but still i cant get the value from child form to parent form. 

My Code is:

when I opened the child form

 

private void button11_Click(object sender, EventArgs e)       

{           

using (New_Category new_Category = new New_Category("ProductDefinition"))           

{               

new_Category.ShowDialog();           

}                       

}


Now from this child form i want to retrieve the value to parent form. the code is given below:

Product_Defination prod = new Product_Defination("","");
Main_form main = new Main_form("", "");
prod.Owner = main;
prod.get_productid_notifyme(Product_id);

System.ComponentMode.Design.ExceptionCollection

$
0
0

I'm trying to view the contents of one of my forms by double clicking it on the SolutionExplorer and get this error message in a separate messagebox: Exception of type  'System.ComponentModel.Design.ExceptionCollection' was thrown.

what happened?  and how can i resurrect my long lost and dearly departed form?

BadButBit


my code is perfect until i don't find a bug

My Shopping list datagridview not show data

$
0
0

Hi

I try to build a shopping list, based in this tutorial.

https://code.tutsplus.com/tutorials/build-a-shopping-cart-in-aspnet--net-1663

For this i have a product, ShoppingCart and CartItem classes. When i test this build, this show everything ok between the classes but my problem begin when i change the product page to Shopping cart page. This not show data.

My Product Class

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
namespace mrosite
{
    public class Product
    {
        public int PCode { get; set; }
        public string PartNumber { get; set; }
        public string Description { get; set; }
        public int Available { get; set; }
        public decimal Price { get; set; }

        public Product(int pcode)
        {
        this.PCode = pcode;
            /* Begin Searh the product code into the database */
            string SqlStr = "SELECT [PCode], [PartNumber], [Description], [PStock], [Price] FROM Products WHERE PCode=@PCode";
            DataSet SqlDs = new DataSet();
            SqlCommand SqlCmd = new SqlCommand(SqlStr);
            String connStr = ConfigurationManager.ConnectionStrings["TOOLCRIB"].ConnectionString;
            SqlConnection SqlConn = new SqlConnection(connStr);
            SqlDataAdapter SqlAdap = new SqlDataAdapter();
            SqlCmd.CommandType = CommandType.Text;
            SqlCmd.Parameters.AddWithValue("@PCode", PCode);
            SqlCmd.Connection = SqlConn;
            SqlAdap.SelectCommand = SqlCmd;
            SqlAdap.Fill(SqlDs, "Prod");
            SqlConn.Close();

            this.PCode= Convert.ToInt32(SqlDs.Tables["Prod"].Rows[0][0]);
            this.PartNumber = SqlDs.Tables["Prod"].Rows[0][1].ToString();
            this.Description = SqlDs.Tables["Prod"].Rows[0][2].ToString();
            this.Available = Convert.ToInt32(SqlDs.Tables["Prod"].Rows[0][3]);
            this.Price = Convert.ToDecimal(SqlDs.Tables["Prod"].Rows[0][4]);

        }
    }
}


My ShoppingCart class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace mrosite
{
    /// <summary>
    /// Summary description for ShoppingCart
    /// </summary>
    public class ShoppingCart
    {
        #region Properties

        public List<CartItem> Items { get; private set; }

        #endregion

        #region Singleton Implementation

        // Readonly properties can only be set in initialization or in a constructor
        public static readonly ShoppingCart Instance;

        // The static constructor is called as soon as the class is loaded into memory
        static ShoppingCart()
        {
            // If the cart is not in the session, create one and put it there
            // Otherwise, get it from the session
            if (HttpContext.Current.Session["ASPNETShoppingCart"] == null)
            {
                Instance = new ShoppingCart();
                Instance.Items = new List<CartItem>();
                HttpContext.Current.Session["ASPNETShoppingCart"] = Instance;
            }
            else
            {
                Instance = (ShoppingCart)HttpContext.Current.Session["ASPNETShoppingCart"];
            }
        }

        // A protected constructor ensures that an object can't be created from outside
        protected ShoppingCart() { }

        #endregion

        #region Item Modification Methods
        /**
         * AddItem() - Adds an item to the shopping 
         */
        public void AddItem(int pCode)
        {
            // Create a new item to add to the cart
            CartItem newItem = new CartItem(pCode);

            // If this item already exists in our list of items, increase the quantity
            // Otherwise, add the new item to the list
            if (Items.Contains(newItem))
            {
                foreach (CartItem item in Items)
                {
                    if (item.Equals(newItem))
                    {
                        item.Quantity++;
                        return;
                    }
                }
            }
            else
            {
                newItem.Quantity = 1;
                Items.Add(newItem);
            }
        }

        /**
         * SetItemQuantity() - Changes the quantity of an item in the cart
         */
        public void SetItemQuantity(int pCode, int quantity)
        {
            // If we are setting the quantity to 0, remove the item entirely
            if (quantity == 0)
            {
                RemoveItem(pCode);
                return;
            }

            // Find the item and update the quantity
            CartItem updatedItem = new CartItem(pCode);

            foreach (CartItem item in Items)
            {
                if (item.Equals(updatedItem))
                {
                    item.Quantity = quantity;
                    return;
                }
            }
        }

        /**
         * RemoveItem() - Removes an item from the shopping cart
         */
        public void RemoveItem(int pCode)
        {
            CartItem removedItem = new CartItem(pCode);
            Items.Remove(removedItem);
        }
        #endregion

        #region Reporting Methods
        /**
         * GetSubTotal() - returns the total price of all of the items
         *                 before tax, shipping, etc.
         */
        public decimal GetSubTotal()
        {
            decimal subTotal = 0;
            foreach (CartItem item in Items)
                subTotal += item.TotalPrice;

            return subTotal;
        }
        #endregion
    }
}

my CartItem class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/**
 * The CartItem Class
 * 
 * Basically a structure for holding item data
 */
namespace mrosite
{
    public class CartItem : IEquatable<CartItem> 
    {
        #region Properties

        // A place to store the quantity in the cart
        // This property has an implicit getter and setter.
        public int Quantity { get; set; }

        private int _productId;
        public int ProductId
        {
            get { return _productId; }
            set {
                // To ensure that the Prod object will be re-created
                _product = null;
                _productId = value;
            }
        }

        private Product _product = null;
        public Product Prod
        {
            get {
                // Lazy initialization - the object won't be created until it is needed
                if (_product == null) {
                    _product = new Product(ProductId);
                }
                return _product;
            }
        }
        public string PartNumber
        {
            get { return Prod.PartNumber; }
        }

        public string Description {
            get { return Prod.Description; }
        }

        public int Available
        {
            get { return Prod.Available; }
        }

        public decimal UnitPrice {
            get { return Prod.Price; }
        }

        public decimal TotalPrice {
            get { return UnitPrice * Quantity; }
        }

        #endregion

        // CartItem constructor just needs a productId
        public CartItem(int productId) {
            this.ProductId = productId;
        }

        /**
        * Equals() - Needed to implement the IEquatable interface
        *    Tests whether or not this item is equal to the parameter
        *    This method is called by the Contains() method in the List class
        *    We used this Contains() method in the ShoppingCart AddItem() method
        */
        public bool Equals(CartItem item) {
            return item.ProductId == this.ProductId;
        }
    }
}

Here the item has been added in the shopping cart

This is how i send the data to the shopping list form from products page

protected void GrdBrowse_RowCommand1(object sender, GridViewCommandEventArgs e)
        {
                if (e.CommandName == "SendCart")
            {
                //Determine the RowIndex of the Row whose Button was clicked.
                int index = Convert.ToInt32(e.CommandArgument);

                //Reference the GridView Row.
                GridViewRow row = GrdBrowse.Rows[index];

                //Fetch value of Product Code
                int myId = Convert.ToInt32(row.Cells[1].Text);

                //Set value for add to shopping cart
                Product Prod = new Product(Convert.ToInt32(row.Cells[1].Text));

                               ShoppingCart.Instance.AddItem(Prod.PCode);
                //----------------------------------------------------------------------                
                Response.Redirect("ViewCart.aspx");
            }
The final result



And thanks for your help.

NetworkStream.BeginRead. Streaming images/video. Dealing with not getting entire image in one read.

$
0
0

I know, don't reinvent the wheel, use an existing library. I'm in a situation where I need to do this without a 3rd party library due to various reasons and I need to engineer this up myself. 

I'm creating a video client server solution for work.  The server allows for a client connection and will send one image at a time to a client this seems to operate just fine. 

My assumption was that for every Write from the server, I would have a 1 to 1 read on the client which I would then turn the bytes into an image and display them in a form control. 

However, that's not the case.  The problem is on the client side when calling NetworkStream.BeginRead(...) because I'm not guaranteed to receive the full image bytes in one read. Which really complicates things because the callback specified in BeginRead operates on a different thread.  

Is there a way to call BeginRead and and get the entire image from the server in one shot before the application loops back around and calls BeginRead again? Because ultimately the second BeginRead would contain bytes from the previous image AND the next image being sent from the server. 

OR... Is this just the nature of the beast and I have to constantly, from the callback, fill some buffer with the byte data, then have some other process that knows how to pluck each image out of that buffer, all the while dealing with threads and locking the data...

Any guidance here would be awesome! 

Thanks.


Rick

C# Exceptions and number in forloop

$
0
0

I show two Exceptions
The first one is when I do not put a number in k

The second Exceptions is if K is more then egg I get an exception in the Parameters.AddWithValue

I like to add a MessageBox.Show to have it add the correct number to k


also how would you add to the output numbers for each row.

1     EG216455
2     nEG216456
3     nEG216457
4     nEG216458
6     nEG216459
7     nEG216460

private void button1_Click(object sender, EventArgs e)
        {
            string egg = textBox1.Text; //egg will show "EG216455\r\nEG216456\r\nEG216457\r\nEG216458\r\nEG216459\r\nEG216460"	
            int k = Convert.ToInt32(textBox2.Text);  // did not put anything in k --- System.FormatException: 'Input string was not in a correct format.'
            string[] stringSeparators = new string[];//EG216455\r\nEG216456\r\nEG216457\r\nEG216458\r\nEG216459\r\nEG216460
            string[] s = egg.Split(stringSeparators, StringSplitOptions.None);


            DataTable dtSerial = new DataTable();
            DataTable table = new DataTable();

            for (int i = 0; i < k; i++)
            {
                                   //ConfigurationManager.ConnectionStrings["pie"].ConnectionString;
                string connString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=Database.mdf;Integrated Security=True";

                using (SqlConnection con = new SqlConnection(connString))
                {
                    using (var cmd = new SqlCommand("SELECT ItemCode,ItemName FROM Table1  where ItemCode = @egg", con))//select eggcounter From [Product].[Counter01unit]  where eggcounter = @egg
                    {
                        cmd.Parameters.AddWithValue("@egg", s[i]); //Exception Unhandled -- System.IndexOutOfRangeException: 'Index was outside the bounds of the array.'
                        con.Open();
                        SqlDataReader reader = cmd.ExecuteReader();
                        dtSerial.Load(reader);
                        table = dtSerial.Clone();
                        foreach (DataRow dr in dtSerial.Rows)
                        {

                            table.Rows.Add(dr.ItemArray);
                        }
                    }
                    con.Close();
                }
            }


            dataGridView1.DataSource = dtSerial;
        }

Function to Import Excel Data to dataset in C#

$
0
0

I want to import data from excel file (that contains one sheet) to dataset using C#. So far, I have tried oledb method, excel data reader method but both of them don't return expected results. In my oledb method, i get rows till 255th row and after 255th row the rows doesn't get returned. But when i change the content of 256th row, I get all the rows (i.e 900 rows as in sheet). It is really weird as I have checked the excel sheet and there is no issue with the contents of the file. There is no macro, and contents of each row are alike (I checked 256th row thoroughly). And when I try excel data reader method it returns 0 rows. I don't know what is the reason for it. Now, I am in search of another method to import excel data to dataset. Could you please let me know any good function that will work for me?

Both of my methods are as follows,

public DataSet GetDataFromExcel(string filePath)
{
    try
    {
    string strConn;
    strConn = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + filePath + ";" + "Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1;TypeGuessRows=0;ImportMixedTypes=Text\"";
    DataTable dt = new DataTable();
    dt = null;
    using (OleDbConnection oleDB = new OleDbConnection(strConn))
    {
        oleDB.Open();
        dt = oleDB.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
        if (dt == null)
            return null;

        ListItemCollection items = new ListItemCollection();
        int i = 0;

        //if (dt.Rows.Count > 1)
        //return null;  

        for (int rowIndex = 0; rowIndex < dt.Rows.Count; rowIndex++)
        {
            string excelSheetName;
            string lastCharacter = "";

            excelSheetName = dt.Rows[rowIndex]["TABLE_NAME"].ToString();
            excelSheetName = excelSheetName.Replace("'", "");
            lastCharacter = excelSheetName.Substring(excelSheetName.Length - 1, 1);
            if (lastCharacter == "$")
            {
                items.Add(dt.Rows[rowIndex]["TABLE_NAME"].ToString());
            }
        }
        if (items.Count > 1)
            return null;

        string sName;
        string query;

        sName = items[0].ToString();
        sName = sName.Replace("'", "");
        sName = sName.Replace("$", "");

        query = "";
        query = String.Format("select * from [{0}$]", sName);
        OleDbDataAdapter da = new OleDbDataAdapter(query, strConn);
        DataSet ds = new DataSet();
        da.Fill(ds);
        return ds;
    }

    }
    catch (Exception ex)
    {

        throw ex;
    }
}



public static DataSet ImportExceltoDataset(string file)
{
    IExcelDataReader iExcelDataReader = null;

    FileStream oStream = File.Open(file, FileMode.Open, FileAccess.Read);

    iExcelDataReader = ExcelReaderFactory.CreateBinaryReader(oStream);

    iExcelDataReader.IsFirstRowAsColumnNames = true;

    DataSet dsUnUpdated = new DataSet();

    dsUnUpdated = iExcelDataReader.AsDataSet();

    iExcelDataReader.Close();

    return dsUnUpdated;
}


Javed Ahmed



Create a NEW file excel without using COM Interop

$
0
0

Hi

I need to create a new file excel and export a datatable in it.

The file needs to be every time a NEW file (not an existing file!)

I dont want to use the Excel.Application.

Is there a way to do this?

I am working with C#, ASP.net (VS2005)

thank you

 

Can I get some help to write an xml to binary

$
0
0

hello,

I am trying to create a binary dictionary file for a program.

The settings file is in xml, and I want the program to load the binary file.

here is the code of the xml:

<?xml version="1.0" encoding="utf-16"?><Lang Version="1.0" AppVersion="1.0.0.0"><Dialogs><Main><Menus><I Name="Main_Menu_Load">Load</I><I Name="Main_Menu_Save">Save</I><I Name="Main_Menu_Exit">Exit</I><I Name="Main_Menu_SaveAll">Save All</I><I Name="Main_Menu_Close">Close</I><I Name="Main_Menu_CloseAll">Close All</I><I Name="Main_Menu_Languages">Languages</I><I Name="Main_Menu_Help">Help</I><I Name="Main_Menu_Help_About">About</I><I Name="Main_Menu_Help_CheckForNewVersion">Check For New Version</I><I Name="Main_Text_LoadLanguage">Load Language {0}</I><I Name="Main_Menu_LoadMultiple">Load Multiple</I><I Name="Main_Menu_EmptyTextsColor">Empty Texts Color</I><I Name="Main_Menu_MatchingTextsColor">Matching Texts Color</I><I Name="Main_Menu_ExpandAll">Expand All</I><I Name="Main_Menu_CollapseAll">Collapse All</I><I Name="Main_Menu_ChangeColors">Change Colors</I></Menus><Headers><I Name="Main_HDR_Name">Name</I><I Name="Main_HDR_WarningName">Name</I><I Name="Main_HDR_WarningLanguages">Languages</I><I Name="Main_HDR_ErrorName">Name</I><I Name="Main_HDR_ErrorLanguage">Language</I></Headers><Texts><Logs><I Name="Main_Text_MissingFormatArgument">Missing format arguments : {0}</I></Logs><I Name="Main_Text_Warnings">{0} Warnings</I><I Name="Main_Text_Errors">{0} Errors</I></Texts></Main></Dialogs><Questions><I Name="Question_SaveChangesToFollowingLangs">Save changes to the following language(s) ?</I></Questions><Infos><I Name="Info_XmlSavedTo">'{0}' xml saved to {1}</I><I Name="Info_DicxSavedTo">'{0}' dicx saved to {1}</I><I Name="Info_LanguageAlreadyLoadedAt">'{0}' already loaded at {1}</I></Infos><Errors><I Name="Error_LanguageItemsAreMissing">{0} language item(s) are missing in {1}</I></Errors><XSystem.Update><Dialogs><I Name="Info_UpdateAvailable">Version : {0} is available</I><I Name="Info_CheckingForNewVersion">Checking for new version</I></Dialogs></XSystem.Update></Lang>

What I need is binarywrite code to save this to a binary file

Here is a link to my project:

LanguageEditor and DicxFiler download

any help would be great

Thank you



Beginner question about checking for button clicking.

$
0
0

Hello there,

I'm an absolute beginner at programming, about a week in, and I'm learning by making my own RPG.

Everything is working as intended, but I've come across an issue where my limited knowledge and poor research ability in this field has flummoxed me.

I have a 'Wait' button, which when pressed, moves on to the next round. The player can choose to click the 'Fight' button if it is their turn (indicated by a speed stat system, such as every 4 turns the player gets a turn). This is all working perfectly, but I would like the Player to be presented with the message 'You do nothing!' if deciding to click the Wait button again, even when they may Fight on that round.

public void btnWait_Click(object sender, EventArgs e)
        {           
            if (round % Player.Speed == 0)
            {                
                combatLog.Text += "Round " + round + "!" + Environment.NewLine;
                isPlayerTurn = true;
                btnFight.Visible = true;                               
                round++;                      
            }            

As you can see, the Fight button becomes visible if on that particular round, the player has a turn. But what I'd like to do, is if the Player presses the Wait button again instead of Fight (when they have a turn available), it will say 'You do nothing!'.

Many thanks in advance :)!

The type or namespace name 'Android' does not exist in the namespace 'Xamarin.Forms.Platform'

$
0
0

Hi guys.
I Updated my nuget packages few days ago to new versions.
but my Android project has 2 errors in MainActivity.cs:
1:
The type or namespace name 'Android' does not exist in the namespace 'Xamarin.Forms.Platform' (are you missing an assembly reference?) Sama.SamaApp.Android MainActivity.cs

2:
'MainActivity.OnCreate(Bundle)': no suitable method found to override MainActivity.cs

i search it in google and find solutions.

But i tested all solutions in two up links but not worked for me.
i tested clear nuget and dotnet caches . removing bin & obj folders . restore nuget packages . remove and reinstall Xamarin.Forms .finally clean rebuilding the solution.
But I could not fix it.
thanks...

Structures Containing the Reference type

$
0
0
    struct MyStruct
    {
        public string myString;

        static void Main(string[] args)
        {
            MyStruct myVariable = new MyStruct();
            myVariable.myString = "Hello"; //This Line
            Console.ReadLine();
        }
    }

Where does myString and myVariable.myString gets Stored? Heap or Stack ? 

Viewing all 31927 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>